Skip to content

Commit 08df6c3

Browse files
authored
Improve error message when debugging fails to start (#908)
1 parent 34007a8 commit 08df6c3

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

docs/RunDebug.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,6 @@ Clicking on the green arrow runs the currently selected debug configuration.
110110

111111
When starting **objectscript launch** debug session, make sure that the file containing the **program** that you are debugging is open in your editor and is the active tab. VS Code will start a debug session with the server of the file in the active editor (the tab that the user is focused on).
112112

113-
Debugging commands and items on the **Run** menu function much as they do for other languages supported by VS Code. For information on VS Code debugging, see the documentation resources listed at the start of this section.
113+
This extension uses WebSockets to communicate with the InterSystems server during debugging. If you are experiencing issues when trying to start a debugging session, check that the InterSystems server's web server allows WebSocket connections.
114+
115+
Debugging commands and items on the **Run** menu function much as they do for other languages supported by VS Code. For information on VS Code debugging, see the documentation resources listed at the start of this section.

src/debug/debugSession.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,6 @@ export class ObjectScriptDebugSession extends LoggingDebugSession {
128128
this._namespace = api.ns;
129129
this._url = api.xdebugUrl();
130130

131-
await api.serverInfo();
132-
133131
const socket = new WebSocket(this._url, {
134132
headers: {
135133
cookie: this.cookies,
@@ -164,8 +162,14 @@ export class ObjectScriptDebugSession extends LoggingDebugSession {
164162

165163
this.sendEvent(new InitializedEvent());
166164
} catch (error) {
165+
let message = "Failed to start the debug session. ";
166+
if (error instanceof Error && error.message == "Connection not active") {
167+
message += "Server connection is inactive.";
168+
} else {
169+
message += "Check that the InterSystems server's web server supports WebSockets.";
170+
}
167171
response.success = false;
168-
response.message = "Debugger can not start";
172+
response.message = message;
169173
this.sendResponse(response);
170174
}
171175
}

0 commit comments

Comments
 (0)