-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
promise: better stack traces for --trace-warnings
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: #9523 PR-URL: #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>
- Loading branch information
1 parent
687137e
commit 6f8b32e
Showing
3 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Flags: --trace-warnings | ||
'use strict'; | ||
require('../common'); | ||
const p = Promise.reject(new Error('This was rejected')); | ||
setImmediate(() => p.catch(() => {})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
(node:*) Error: This was rejected | ||
at * (*test*message*unhandled_promise_trace_warnings.js:*) | ||
at * | ||
at * | ||
at * | ||
at * | ||
at * | ||
at * | ||
at * | ||
at * | ||
at * | ||
(node:*) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 1) | ||
at getAsynchronousRejectionWarningObject (internal/process/promises.js:*) | ||
at rejectionHandled (internal/process/promises.js:*) | ||
at * | ||
at Promise.then (native) | ||
at Promise.catch (native) | ||
at Immediate.setImmediate (*test*message*unhandled_promise_trace_warnings.js:*) | ||
at * | ||
at * | ||
at * |