chore(plugin-sql-editor): improve error message

CB-204
This commit is contained in:
Wroud
2020-07-15 12:26:55 +03:00
parent 6be972f010
commit 49f6cb4b40
2 changed files with 17 additions and 4 deletions
@@ -124,11 +124,13 @@ export class SqlEditorNavigatorService {
if (data.type === SQLEditorNavigationAction.create) {
const tabOptions = await this.createNewEditor(data.connectionId, data.catalogId, data.schemaId);
const connectionInfo = this.connectionInfoResource.get(data.connectionId || '');
if (tabOptions) {
tabInfo.openNewTab(tabOptions);
} else {
this.notificationService.logError({
title: `Failed to create editor for ${data.connectionId} connection`,
title: `Failed to create editor for ${connectionInfo?.name || data.connectionId} connection`,
});
}
return;
@@ -168,10 +170,15 @@ export class SqlEditorNavigatorService {
connectionId = Array.from(this.connectionInfoResource.data.values())[0].id;
}
const connection = await this.connectionAuthService.auth(connectionId);
try {
const connection = await this.connectionAuthService.auth(connectionId);
if (!connection?.connected) {
return null;
if (!connection?.connected) {
return null;
}
} catch (exception) {
this.notificationService.logException(exception);
throw exception;
}
await this.sqlDialectInfoService.loadSqlDialectInfo(connectionId);
@@ -112,6 +112,12 @@ export class SqlEditorTabService {
if (!connection?.connected) {
return false;
}
} catch (exception) {
this.notificationService.logException(exception);
return false;
}
try {
// try to create new context first
const context = await this.createSqlContext(connectionId);