From a4d5814adfbddf0d35a979f46ee326d013747b52 Mon Sep 17 00:00:00 2001 From: Chareice Date: Wed, 31 Jan 2024 20:42:42 +0800 Subject: [PATCH] fix: error display --- .../src/server/models/data-source.ts | 3 ++- .../@nocobase/plugin-data-source-manager/src/server/plugin.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/plugins/@nocobase/plugin-data-source-manager/src/server/models/data-source.ts b/packages/plugins/@nocobase/plugin-data-source-manager/src/server/models/data-source.ts index 4baa152fad..b4fd7e31ba 100644 --- a/packages/plugins/@nocobase/plugin-data-source-manager/src/server/models/data-source.ts +++ b/packages/plugins/@nocobase/plugin-data-source-manager/src/server/models/data-source.ts @@ -100,10 +100,11 @@ export class DataSourceModel extends Model { localData: await this.loadLocalData(), }); } catch (e) { - this.app.logger.error(`load data source failed, ${e.message}`); + app.logger.error(`load data source failed, ${e.message}`); pluginDataSourceManagerServer.dataSourceStatus[dataSourceKey] = 'failed'; pluginDataSourceManagerServer.dataSourceErrors[dataSourceKey] = e; + return; } pluginDataSourceManagerServer.dataSourceStatus[dataSourceKey] = 'loaded'; diff --git a/packages/plugins/@nocobase/plugin-data-source-manager/src/server/plugin.ts b/packages/plugins/@nocobase/plugin-data-source-manager/src/server/plugin.ts index baddde21a7..53bf4ba524 100644 --- a/packages/plugins/@nocobase/plugin-data-source-manager/src/server/plugin.ts +++ b/packages/plugins/@nocobase/plugin-data-source-manager/src/server/plugin.ts @@ -127,7 +127,7 @@ export class PluginDataSourceManagerServer extends Plugin { }; if (dataSourceStatus === 'failed') { - item['errorMessage'] = this.dataSourceErrors[dataSourceModel.get('key')].message; + item['errorMessage'] = plugin.dataSourceErrors[dataSourceModel.get('key')].message; } const dataSource = app.dataSourceManager.dataSources.get(dataSourceModel.get('key'));