Skip to content

process: add --unhandled-rejections flag

This adds a flag to define the default behavior for unhandled rejections. Three modes exist: none, warn and strict. The first is going to silence all unhandled rejection warnings. The second behaves identical to the current default with the excetion that no deprecation warning will be printed and the last is going to throw an error for each unhandled rejection, just as regular exceptions do. It is possible to intercept those with the uncaughtException hook as with all other exceptions as well.

This PR has no influence on the existing unhandledRejection hook. If that is used, it will continue to function as before.

Supersedes https://github.com/nodejs/node/pull/20097

// CC @nodejs/diagnostics @nodejs/promises-debugging @nodejs/tsc

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Merge request reports

Loading