Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugger not stopping on uncaught exceptions within a top-level await #2057

Closed
rendmath opened this issue Aug 15, 2024 · 1 comment
Closed
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug *out-of-scope Posted issue is not in scope of VS Code

Comments

@rendmath
Copy link

rendmath commented Aug 15, 2024

Describe the bug
The debugger does not stop on uncaught exceptions from a Node.js library if the call is nested within a top-level await.

To Reproduce

package.json

{
  "type": "module"
}

index.js

import { writeFile } from "fs/promises";

await fail();

export async function fail() {
  await writeFile("does/not/exist", "hello");
}

launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Launch Program",
      "skipFiles": ["<node_internals>/**"],
      "program": "${workspaceFolder}/index.js"
    }
  ]
}
  1. Setup the project as detailed above.
  2. Check "Caught Exceptions" and "Uncaught Exceptions" in the debugger panel.
  3. Hit F5.
  4. No breakpoint is hit.

Log File
Debug console.

C:\Program Files\nodejs\node.exe .\index.js
Uncaught Error Error: ENOENT: no such file or directory, open 'C:\sources\personal\top-level-await-debug\does\not\exist'
    --- await ---
    at runEntryPointWithESMLoader (internal/modules/run_main:139:19)
    at executeUserEntryPoint (internal/modules/run_main:173:5)
    at <anonymous> (internal/main/run_main_module:30:49)
run_main:139
Process exited with code 1

vscode-debugadapter-6410230d.json.gz

VS Code Version: 1.92.1

@rendmath rendmath added the bug Issue identified by VS Code Team member as probable bug label Aug 15, 2024
@connor4312
Copy link
Member

This is a bug in Node.js: nodejs/node#50430

@connor4312 connor4312 added the *out-of-scope Posted issue is not in scope of VS Code label Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug *out-of-scope Posted issue is not in scope of VS Code
Projects
None yet
Development

No branches or pull requests

2 participants