I'm debugging some TS code and ran into a strange issue - despite "Caught Exceptions" box being checked, the debugger does not pause. I've reproduced it with this simple example:
try {
const buf = Buffer.alloc(12);
buf.readInt32LE(16);
} catch (e) {
console.log(e);
}
It reaches the console.log
line without breaking on the initial exception, making it hard to tell where it came from (in a real scenario with more complex code). Only directly thrown exceptions cause the debugger to break.
launch.json
:
{
"version": "0.2.0",
"configurations": [
{
"name": "tsx",
"type": "node",
"request": "launch",
"runtimeExecutable": "tsx",
"args": ["${relativeFile}"],
"cwd": "${workspaceRoot}",
"internalConsoleOptions": "openOnSessionStart"
}
]
}
It does not pause on uncaught exceptions either, removing the try-catch results in process crashing with error message in console.
I'm debugging some TS code and ran into a strange issue - despite "Caught Exceptions" box being checked, the debugger does not pause. I've reproduced it with this simple example:
try {
const buf = Buffer.alloc(12);
buf.readInt32LE(16);
} catch (e) {
console.log(e);
}
It reaches the console.log
line without breaking on the initial exception, making it hard to tell where it came from (in a real scenario with more complex code). Only directly thrown exceptions cause the debugger to break.
launch.json
:
{
"version": "0.2.0",
"configurations": [
{
"name": "tsx",
"type": "node",
"request": "launch",
"runtimeExecutable": "tsx",
"args": ["${relativeFile}"],
"cwd": "${workspaceRoot}",
"internalConsoleOptions": "openOnSessionStart"
}
]
}
It does not pause on uncaught exceptions either, removing the try-catch results in process crashing with error message in console.
Share Improve this question asked Nov 16, 2024 at 8:43 rivriv 7,4013 gold badges41 silver badges74 bronze badges1 Answer
Reset to default 0Try set "skipFiles": []
in your launch.json.
Caught exception affected by this config.
I solve a similar problem using this config.