Skip to content

Not pausing on uncaught exceptions for modules #1861

Closed
@twilson90

Description

@twilson90

Describe the bug
Not sure when this started as I haven't been using ES6 Modules very long in my NodeJS projects.
I believe it started recently but wasn't an issue prior.

If I run the following:

import path from "path";
throw new Error();

When the debugger encounter's the error it immediately exits and prints:
Process exited with code 1
Which isn't very helpful at all. No stack trace, no pause, nothing.

In another project I started to demo this issue I noticed I was getting a stack trace but still no pause:

Uncaught Error Error
    at <anonymous> (file:///C:/Users/Tom/Downloads/esm-test/index.mjs:2:7)
    at run (node:internal/modules/esm/module_job:217:25)
    --- await ---
    at runMainESM (node:internal/modules/run_main:53:21)
    at executeUserEntryPoint (node:internal/modules/run_main:79:5)
    at <anonymous> (node:internal/main/run_main_module:23:47)

I've got 'Uncaught Exceptions' checked under breakpoints.
Manually set breakpoints still work.
It doesn't matter if it errors in an async block, it doesn't pause in synchronously run blocks as well.
I've been getting by recently by using this code to help track down errors, but it's still pretty inconvenient:

process.on("uncaughtException", (e)=>{
  console.trace(e);
})

As far as I can tell this isn't an issue if the Javascript file is not a module (ie, package.json "type": "module")
Tried re-installing VS Code and removing all addons without any luck.

Log File
vscode-debugadapter-b23cbcbc.json.gz

VS Code Version:
Version: 1.83.1 (user setup)
Commit: f1b07bd25dfad64b0167beb15359ae573aecd2cc
Date: 2023-10-10T23:48:05.904Z
Electron: 25.8.4
ElectronBuildId: 24154031
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.22621

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions