mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
196d27dd8c
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: https://github.com/nodejs/node/issues/9523 PR-URL: https://github.com/nodejs/node/pull/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>
6 lines
160 B
JavaScript
6 lines
160 B
JavaScript
// Flags: --trace-warnings
|
|
'use strict';
|
|
require('../common');
|
|
const p = Promise.reject(new Error('This was rejected'));
|
|
setImmediate(() => p.catch(() => {}));
|