Skip to content

promises: improve unhandledrejection warnings

Per the CTC discussion around https://github.com/nodejs/node/pull/12734 ...

This takes an alternative approach than https://github.com/nodejs/node/pull/12734. Rather than adding a throw, it improves the warnings that are already there such that the stack trace for the rejection reason is always shown (assuming the reason is an Error object). It also adds a warning.reason property to the warning object emitted by process.on('warning'), allowing userland code to access the original error (and potentially throw if it wishes to do so).

other code cleanups were made while I was in there.

/cc @nodejs/ctc

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

promises

Merge request reports

Loading