Browse Source

Throws an error if the kernel cannot start the debugger

Johan Mabille 4 years ago
parent
commit
aa60ce54a0
1 changed files with 5 additions and 1 deletions
  1. 5 1
      packages/debugger/src/session.ts

+ 5 - 1
packages/debugger/src/session.ts

@@ -109,7 +109,7 @@ export class DebuggerSession implements IDebugger.ISession {
    * Start a new debug session
    */
   async start(): Promise<void> {
-    await this.sendRequest('initialize', {
+    const reply = await this.sendRequest('initialize', {
       clientID: 'jupyterlab',
       clientName: 'JupyterLab',
       adapterID: this.connection?.kernel?.name ?? '',
@@ -122,6 +122,10 @@ export class DebuggerSession implements IDebugger.ISession {
       locale: document.documentElement.lang
     });
 
+    if (!reply.success) {
+      throw new Error(`Could not start the debugger: ${reply.message}`);
+    }
+
     this._isStarted = true;
 
     await this.sendRequest('attach', {});