fix: error display

This commit is contained in:
Chareice 2024-01-31 20:42:42 +08:00
parent 01faadb0b4
commit a4d5814adf
No known key found for this signature in database
2 changed files with 3 additions and 2 deletions

View File

@ -100,10 +100,11 @@ export class DataSourceModel extends Model {
localData: await this.loadLocalData(), localData: await this.loadLocalData(),
}); });
} catch (e) { } 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.dataSourceStatus[dataSourceKey] = 'failed';
pluginDataSourceManagerServer.dataSourceErrors[dataSourceKey] = e; pluginDataSourceManagerServer.dataSourceErrors[dataSourceKey] = e;
return;
} }
pluginDataSourceManagerServer.dataSourceStatus[dataSourceKey] = 'loaded'; pluginDataSourceManagerServer.dataSourceStatus[dataSourceKey] = 'loaded';

View File

@ -127,7 +127,7 @@ export class PluginDataSourceManagerServer extends Plugin {
}; };
if (dataSourceStatus === 'failed') { 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')); const dataSource = app.dataSourceManager.dataSources.get(dataSourceModel.get('key'));