Skip to content

errors: trace unhandled promise rejection location#64201

Closed
legendecas wants to merge 1 commit into
nodejs:mainfrom
legendecas:trace-unhandled-rejection
Closed

errors: trace unhandled promise rejection location#64201
legendecas wants to merge 1 commit into
nodejs:mainfrom
legendecas:trace-unhandled-rejection

Conversation

@legendecas

@legendecas legendecas commented Jun 29, 2026

Copy link
Copy Markdown
Member

Print where an unhandled promise is been rejected with flag
--trace-uncaught. This also locates the rejection site when a promise
is rejected with a primitive values.

For example, when an error is constructed at a place that's different
from where it is thrown, --trace-uncaught would print the location
where it is thrown.

const err = new Error("foo");
//          ^ this is where the error is constructed


function foo() {
  throw err;
  ^
//this is where the error is thrown
}

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. process Issues and PRs related to the process subsystem. labels Jun 29, 2026
@legendecas legendecas force-pushed the trace-unhandled-rejection branch 2 times, most recently from bc40f2b to e8c692b Compare June 29, 2026 19:46
Print where an unhandled promise is been rejected with flag
`--trace-uncaught`. This also locates the rejection site when a promise
is rejected with a primitive values.

Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
@legendecas legendecas force-pushed the trace-unhandled-rejection branch from e8c692b to 4535857 Compare June 29, 2026 20:28
@legendecas

Copy link
Copy Markdown
Member Author

There are a few cases where V8 calls PromiseRejectCallback not at where the promise is rejected. Might need to fix in V8 first.

@legendecas legendecas closed this Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. process Issues and PRs related to the process subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants