Skip to content

Commit 1e80283

Browse files
authored
1 parent 303c570 commit 1e80283

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

src/extension.ts

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -842,25 +842,25 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
842842
vscode.commands.registerCommand("vscode-objectscript.pickProcess", async (config) => {
843843
const system = config.system;
844844
const api = new AtelierAPI(vscode.window.activeTextEditor?.document.uri);
845-
const convert = async (jobData) => {
846-
// NOTE: We do not know if the current user has permissions to other namespaces, so lets only fetch the job infos
847-
// for the current namespace.
845+
846+
const list = await api.getJobs(system).then(async (jobData) => {
847+
// NOTE: We do not know if the current user has permissions to other namespaces
848+
// so lets only fetch the job info for the current namespace
848849
const currNamespaceJobs: { [k: string]: string } = await api
849-
.actionQuery("SELECT Job, ConfigName FROM Ens.Job_Enumerate() where State = 'Alive'", [])
850+
.actionQuery("SELECT Job, ConfigName FROM Ens.Job_Enumerate() WHERE State = 'Alive'", [])
850851
.then((data) => Object.fromEntries(data.result.content.map((x) => [x.Job, x.ConfigName])))
851852
.catch((error) => {
852-
// Current namespace is not Interoperability-enabled, there is no Ens.Job_Enumerate procedure
853-
if (error && error.errorText.includes("'ENS.JOB_ENUMERATE'(...)")) {
854-
return {};
855-
}
856-
857-
let message = `Failed to fetch namespace '${api.ns}' job config names.`;
858-
if (error && error.errorText && error.errorText !== "") {
853+
if (
854+
error &&
855+
error.errorText &&
856+
!error.errorText.includes("'ENS.JOB_ENUMERATE'(...)") &&
857+
error.errorText != ""
858+
) {
859+
// Hide errors about Ens.Job_Enumerate procedure not existing because
860+
// the current namespace may not be Interoperability-enabled
859861
outputChannel.appendLine("\n" + error.errorText);
860862
outputChannel.show(true);
861-
message += " Check 'ObjectScript' output channel for details.";
862863
}
863-
vscode.window.showErrorMessage(message, "Dismiss");
864864
return {};
865865
});
866866

@@ -879,9 +879,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<any> {
879879
};
880880
}
881881
});
882-
};
883-
884-
const list = await api.getJobs(system).then(convert);
882+
});
885883
if (!list.length) {
886884
vscode.window.showInformationMessage(`No attachable processes are running in ${api.ns}.`, {
887885
modal: true,

0 commit comments

Comments
 (0)