Skip to content

Synchronous exceptions in ES modules are always 'caught' #50430

Open
@connor4312

Description

@connor4312

Version

20.3.1

Platform

Darwin mbp.peet.io 22.6.0 Darwin Kernel Version 22.6.0: Fri Sep 15 13:39:52 PDT 2023; root:xnu-8796.141.3.700.8~1/RELEASE_X86_64 x86_64

Subsystem

inspector

What steps will reproduce the bug?

  1. Start a program containing throw new Error('foo'); in an ES module
  2. Attach a debugger, like devtools or VS Code's debugger, and enable "pause on uncaught exceptions"
  3. Run the program

How often does it reproduce? Is there a required condition?

100%

What is the expected behavior? Why is that the expected behavior?

The runtime should pause on the throw line

What do you see instead?

The runtime does not pause and the program exits

Additional information

First reported in microsoft/vscode-js-debug#1861

Guessing this is because module evaluation is in a try/catch. Wonder if there's any machinery that can be used to mark containing exceptions as uncaught

try {
await this.module.evaluate(timeout, breakOnSigint);
} catch (e) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.esmIssues and PRs related to the ECMAScript Modules implementation.inspectorIssues and PRs related to the V8 inspector protocolv8 engineIssues and PRs related to the V8 dependency.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions