set_pause_on_exceptions
Control when the debugger pauses on exceptions—choose to pause on all exceptions, only uncaught ones, or never—to precisely catch errors during JavaScript debugging sessions.
Instructions
Configures whether the debugger should pause when exceptions are thrown. Useful for catching errors as they occur.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | Yes | ID of the debugging session. | |
| state | Yes | When to pause: "none" (never pause on exceptions), "uncaught" (pause only on uncaught exceptions), "all" (pause on all exceptions, including caught ones). |
Implementation Reference
- src/server.ts:921-949 (handler)The tool handler for 'set_pause_on_exceptions'. Parses session_id and state from input, calls sessionManager.setPauseOnExceptions(), and returns success with the state.
case 'set_pause_on_exceptions': { const params = z .object({ session_id: z.string(), state: z.enum(['none', 'uncaught', 'all']), }) .parse(args); await sessionManager.setPauseOnExceptions( params.session_id, params.state ); return { content: [ { type: 'text', text: JSON.stringify( { success: true, state: params.state, }, null, 2 ), }, ], }; } - src/server.ts:385-401 (schema)Input schema for the tool: requires session_id (string) and state (enum: 'none', 'uncaught', 'all').
inputSchema: { type: 'object', properties: { session_id: { type: 'string', description: 'ID of the debugging session.', }, state: { type: 'string', enum: ['none', 'uncaught', 'all'], description: 'When to pause: "none" (never pause on exceptions), ' + '"uncaught" (pause only on uncaught exceptions), ' + '"all" (pause on all exceptions, including caught ones).', }, }, required: ['session_id', 'state'], - src/server.ts:381-403 (registration)Registration of the tool in the server's tool list with name 'set_pause_on_exceptions', description, and input schema.
name: 'set_pause_on_exceptions', description: 'Configures whether the debugger should pause when exceptions are thrown. ' + 'Useful for catching errors as they occur.', inputSchema: { type: 'object', properties: { session_id: { type: 'string', description: 'ID of the debugging session.', }, state: { type: 'string', enum: ['none', 'uncaught', 'all'], description: 'When to pause: "none" (never pause on exceptions), ' + '"uncaught" (pause only on uncaught exceptions), ' + '"all" (pause on all exceptions, including caught ones).', }, }, required: ['session_id', 'state'], }, }, - src/session-manager.ts:499-505 (helper)SessionManager.setPauseOnExceptions() - delegates to the CDP client for the given session.
async setPauseOnExceptions( sessionId: string, state: 'none' | 'uncaught' | 'all' ): Promise<void> { const session = this.getSession(sessionId); await session.cdpClient.setPauseOnExceptions(state); } - src/cdp-client.ts:259-264 (helper)CDPClient.setPauseOnExceptions() - sends the Debugger.setPauseOnExceptions CDP command with the given state.
async setPauseOnExceptions( state: 'none' | 'uncaught' | 'all' ): Promise<void> { this.ensureConnected(); await this.client!.Debugger.setPauseOnExceptions({state}); }