Skip to content

promise: Add --throw-unhandled-rejection and --trace-unhandled-rejection

Checklist
  • tests and code linting passes
  • a test and/or benchmark is included
  • documentation is changed or added
  • the commit message follows commit guidelines
Affected core subsystem(s)

promise

Description of change

We are writing a lots of Promise modules and test these modules in our development environment. When process.on('unhandledRejection') error is occurred, default node behavior does not send any message, no warnings, no exceptions. So we have to prepare the following code and add tests.

process.on('unhandledRejection', (reason) => {
  throw reason;
});

This is not so easy for Promise / Node beginner. So I would like to propose the following 2 options.

  1. --throw-unhandled-rejection option will throw Exception when no unhandledRejection listener
  2. --trace-unhandled-rejection option will output stderr when no unhandledRejection listener

I know the default unhandledRejection behavior is discussing here https://github.com/nodejs/promises/issues/26

But I would like to add these options to help our developments.

Merge request reports

Loading