-
Notifications
You must be signed in to change notification settings - Fork 338
Description
Describe the bug
The VSCode debugger does not break execution if an exception is thrown in a skipped file that unwinds through a non-skipped file before it gets caught, even if Caught exceptions is checked.
To Reproduce
Steps to reproduce the behavior:
Create file myModule.mjs:
export function foo() {
throw new Error('boom');
}Create file test.cjs:
import('./myModule.mjs').then(({foo}) => {
try {
foo();
} catch (e) {
console.log(e);
}
});Create file .vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"**/myModule.mjs"
],
"program": "${workspaceFolder}/test.cjs"
}
]
}Launch the program.
Observed behavior: the exception is logged to the Debug Console but execution does not break into the debugger.
Desired behavior: the debugger breaks at test.cjs line 3, just like it would if the exception was uncaught. (Indeed, after commenting out the try line and the catch block, the debugger breaks at test.cjs line 3.)
Log File:
vscode-debugadapter-a27cb186.json
VS Code Version:
Version: 1.104.2 (Universal)
Commit: e3a5acfb517a443235981655413d566533107e92
Date: 2025-09-24T11:21:37.073Z
Electron: 37.3.1
ElectronBuildId: 12404162
Chromium: 138.0.7204.235
Node.js: 22.18.0
V8: 13.8.258.31-electron.0
OS: Darwin arm64 24.6.0
Additional context
I tried this program in Chrome, after adding myModule.mjs to the ignore list. It will break at the throw statement in myModule.mjs, even if that file is on the ignore list. That is also not optimal, IMHO, but better than the current VSCode behavior.
(BTW: This also affects users that do not mess with the skipFiles configuration, because it also applies to Node.js internals such as assert. This bug makes it harder to diagnose Node.js assertion failures.)