Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled promise rejection deprecation message is printed even when there's an unhandledRejection listener #28539

Closed
nwoltman opened this issue Jul 4, 2019 · 1 comment · Fixed by #28540

Comments

@nwoltman
Copy link
Contributor

nwoltman commented Jul 4, 2019

  • Version: v12.6.0
  • Platform: Windows
  • Subsystem: lib

The unhandled promise rejection deprecation message is printed even when a promise rejection error is handled by an unhandledRejection listener.

The following program did not produce a deprecation warning with Node 12.5.0, but it does now with Node 12.6.0:

process.on('unhandledRejection', (err) => {
  console.log('Handled rejection:', err.message);
});

Promise.reject(new Error('rejection error'));

Output:

Handled rejection: rejection error
(node:17332) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Expected output:

Handled rejection: rejection error

This issue may have been caused by #28258.

@nwoltman
Copy link
Contributor Author

nwoltman commented Jul 4, 2019

cc @joyeecheung

cjihrig added a commit to cjihrig/node that referenced this issue Jul 7, 2019
This commit prevents a deprecation warning from being emitted
if the unhandledRejection event was actually handled.

PR-URL: nodejs#28540
Fixes: nodejs#28539
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Masashi Hirano <shisama07@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
targos pushed a commit that referenced this issue Jul 20, 2019
This commit prevents a deprecation warning from being emitted
if the unhandledRejection event was actually handled.

PR-URL: #28540
Fixes: #28539
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Masashi Hirano <shisama07@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant