Skip to content

v6.x backport: promise: better stack traces for --trace-warnings #10378

New issue

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

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

Already on GitHub? # to your account

Closed
wants to merge 1 commit into from

Conversation

addaleax
Copy link
Member

@addaleax addaleax commented Dec 21, 2016

Backport of #9525 to v6.x

Had to resolve a minor conflict in lib/internal/process/promises.js and remove the deprecation message from the test output.

Given that there was some worrying about breakage in #9525, this can wait for a bit if that makes people feel more comfortable. Generally the reactions so far seem to be positive, though.

CI: https://ci.nodejs.org/job/node-test-commit/6764/


Give better stack traces for PromiseRejectionHandledWarning
and UnhandledPromiseRejectionWarnings.

For PromiseRejectionHandledWarning, when it is likely that there
is an Error object generated, it is created early to provide a
proper stack trace.

For UnhandledPromiseRejectionWarning, the stack trace of the
underlying error object is used, if possible.

Fixes: #9523
PR-URL: #9525

Give better stack traces for `PromiseRejectionHandledWarning`
and `UnhandledPromiseRejectionWarning`s.

For `PromiseRejectionHandledWarning`, when it is likely that there
is an `Error` object generated, it is created early to provide a
proper stack trace.

For `UnhandledPromiseRejectionWarning`, the stack trace of the
underlying error object is used, if possible.

Fixes: nodejs#9523
PR-URL: nodejs#9525
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
@addaleax addaleax added the promises Issues and PRs related to ECMAScript promises. label Dec 21, 2016
@addaleax
Copy link
Member Author

Landed in v6.x-staging at 8f5c372

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
promises Issues and PRs related to ECMAScript promises.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants