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

module: unsuppress "pause on uncaught exceptions" on module-level promises #54015

Closed
wants to merge 2 commits into from

Conversation

rotu
Copy link

@rotu rotu commented Jul 24, 2024

Previously, module-level promise rejections are always considered "caught exception" by the debugger; now such promise rejections may be considered "caught" or "uncaught", depending on whether there is an enclosing catch in the module code itself.

Note this does NOT affect whether an "unhandledRejection" event is emitted (which is based on whether a handler is actually attached) #53732

// in a .mjs file

// before this PR: pause if "pause on caught exceptions"
// after: pause if "pause on uncaught exceptions"
await Promise.reject()

// unchanged: pause if "pause on caught exceptions"
try { await Promise.reject() } catch {}

setTimeout(async ()=>{
  // unchanged: pause if "pause on uncaught exceptions"
  await Promise.reject()
})

setTimeout(async ()=>{
  // unchanged: pause if "pause on caught exceptions"
  try { await Promise.reject() } catch {}
})

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/loaders

@nodejs-github-bot nodejs-github-bot added esm Issues and PRs related to the ECMAScript Modules implementation. needs-ci PRs that need a full CI run. labels Jul 24, 2024
@rotu
Copy link
Author

rotu commented Jul 24, 2024

Well, I gave it a shot but I couldn't figure out how to accomplish this in a clean way. My attempted fix did not work.

@rotu rotu closed this Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
esm Issues and PRs related to the ECMAScript Modules implementation. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants