fix(plugin-sql-editor-navigation-tab-resource): CB-2122 error message on context menu opening

This commit is contained in:
Wroud
2022-07-04 15:57:25 +03:00
parent 5d5cef75f8
commit 15576751da
@@ -160,15 +160,24 @@ export class PluginBootstrap extends Bootstrap {
try {
const nodeInfo = await contexts.getContext(this.navNodeManagerService.navigationNavNodeContext);
const node = await this.navNodeInfoResource.load(data.nodeId);
const resource = await this.navResourceNodeService.loadResourceInfo(node.id);
if (node.nodeType !== RESOURCE_NODE_TYPE || !isScript(node.id)) {
return;
}
const resource = await this.navResourceNodeService.loadResourceInfo(node.id);
if (!resource) {
throw new Error('Resource not found');
if (data.type === NavigationType.open) {
throw new Error('Resource not found');
} else {
return;
}
}
nodeInfo.markOpen();
if (data.type !== NavigationType.open) {
return;
}
const maxSize = this.sqlEditorSettingsService.settings.getValue('maxFileSize');
@@ -184,12 +193,6 @@ export class PluginBootstrap extends Bootstrap {
return;
}
nodeInfo.markOpen();
if (data.type !== NavigationType.open) {
return;
}
const tab = this.sqlEditorTabResourceService.getResourceTab(node.id);
if (tab) {