Skip to content

Commit 7384a0b

Browse files
Better messaging (or not) when Lite Terminal launch is aborted (fix #1472) (#1473)
1 parent 37357e0 commit 7384a0b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/commands/webSocketTerminal.ts

+10-4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import { AtelierAPI } from "../api";
55
import { connectionTarget, currentFile, getWsServerConnection, handleError, notIsfs, outputChannel } from "../utils";
66
import { config, iscIcon, resolveConnectionSpec } from "../extension";
77

8+
const NO_ELIGIBLE_CONNECTIONS =
9+
"Lite Terminal requires an active server connection to InterSystems IRIS version 2023.2 or above.";
10+
811
const keys = {
912
enter: "\r",
1013
backspace: "\x7f",
@@ -766,6 +769,9 @@ export async function launchWebSocketTerminal(targetUri?: vscode.Uri): Promise<v
766769
} else {
767770
// Determine the server connection to use
768771
targetUri = currentFile()?.uri ?? (await getWsServerConnection("2023.2.0"));
772+
if (targetUri === undefined) {
773+
vscode.window.showErrorMessage(NO_ELIGIBLE_CONNECTIONS);
774+
}
769775
if (!targetUri) return;
770776
}
771777
const api = new AtelierAPI(targetUri);
@@ -791,10 +797,10 @@ export class WebSocketTerminalProfileProvider implements vscode.TerminalProfileP
791797
// Get the terminal configuration. Will throw if there's an error.
792798
const terminalOpts = terminalConfigForUri(new AtelierAPI(uri), uri, true);
793799
return new vscode.TerminalProfile(terminalOpts);
794-
} else if (uri == undefined) {
795-
throw new Error(
796-
"Lite Terminal requires an active server connection to InterSystems IRIS version 2023.2 or above."
797-
);
800+
} else if (uri === undefined) {
801+
throw new Error(NO_ELIGIBLE_CONNECTIONS);
802+
} else {
803+
throw new Error("No connection was chosen.");
798804
}
799805
}
800806
}

0 commit comments

Comments
 (0)