Skip to content

Commit

Permalink
Better messaging (or not) when Lite Terminal launch is aborted (fix #…
Browse files Browse the repository at this point in the history
  • Loading branch information
gjsjohnmurray authored Feb 3, 2025
1 parent 37357e0 commit 7384a0b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/commands/webSocketTerminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { AtelierAPI } from "../api";
import { connectionTarget, currentFile, getWsServerConnection, handleError, notIsfs, outputChannel } from "../utils";
import { config, iscIcon, resolveConnectionSpec } from "../extension";

const NO_ELIGIBLE_CONNECTIONS =
"Lite Terminal requires an active server connection to InterSystems IRIS version 2023.2 or above.";

const keys = {
enter: "\r",
backspace: "\x7f",
Expand Down Expand Up @@ -766,6 +769,9 @@ export async function launchWebSocketTerminal(targetUri?: vscode.Uri): Promise<v
} else {
// Determine the server connection to use
targetUri = currentFile()?.uri ?? (await getWsServerConnection("2023.2.0"));
if (targetUri === undefined) {
vscode.window.showErrorMessage(NO_ELIGIBLE_CONNECTIONS);
}
if (!targetUri) return;
}
const api = new AtelierAPI(targetUri);
Expand All @@ -791,10 +797,10 @@ export class WebSocketTerminalProfileProvider implements vscode.TerminalProfileP
// Get the terminal configuration. Will throw if there's an error.
const terminalOpts = terminalConfigForUri(new AtelierAPI(uri), uri, true);
return new vscode.TerminalProfile(terminalOpts);
} else if (uri == undefined) {
throw new Error(
"Lite Terminal requires an active server connection to InterSystems IRIS version 2023.2 or above."
);
} else if (uri === undefined) {
throw new Error(NO_ELIGIBLE_CONNECTIONS);
} else {
throw new Error("No connection was chosen.");
}
}
}

0 comments on commit 7384a0b

Please sign in to comment.