Skip to content

Commit

Permalink
process: refs --unhandled-rejections documentation in warning message
Browse files Browse the repository at this point in the history
Refs: #20392

PR-URL: #30564
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
aduh95 authored and BethGriggs committed Feb 6, 2020
1 parent 178acac commit 1bcbc70
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions lib/internal/process/promises.js
Expand Up @@ -134,6 +134,9 @@ function emitUnhandledRejectionWarning(uid, reason) {
'Unhandled promise rejection. This error originated either by ' +
'throwing inside of an async function without a catch block, ' +
'or by rejecting a promise which was not handled with .catch(). ' +
'To terminate the node process on unhandled promise ' +
'rejection, use the CLI flag `--unhandled-rejections=strict` (see ' +
'https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). ' +
`(rejection id: ${uid})`
);
try {
Expand Down
5 changes: 4 additions & 1 deletion test/parallel/test-promises-unhandled-proxy-rejections.js
Expand Up @@ -12,7 +12,10 @@ const expectedPromiseWarning = ['Unhandled promise rejection. ' +
'This error originated either by throwing ' +
'inside of an async function without a catch ' +
'block, or by rejecting a promise which was ' +
'not handled with .catch(). (rejection id: 1)'];
'not handled with .catch(). To terminate the ' +
'node process on unhandled promise rejection, ' +
'use the CLI flag `--unhandled-rejections=strict` (see ' +
'https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)'];

function throwErr() {
throw new Error('Error from proxy');
Expand Down
5 changes: 4 additions & 1 deletion test/parallel/test-promises-unhandled-symbol-rejections.js
Expand Up @@ -13,7 +13,10 @@ const expectedPromiseWarning = ['Unhandled promise rejection. ' +
'This error originated either by throwing ' +
'inside of an async function without a catch ' +
'block, or by rejecting a promise which was ' +
'not handled with .catch(). (rejection id: 1)'];
'not handled with .catch(). To terminate the ' +
'node process on unhandled promise rejection, ' +
'use the CLI flag `--unhandled-rejections=strict` (see ' +
'https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)'];

common.expectWarning({
DeprecationWarning: expectedDeprecationWarning,
Expand Down

0 comments on commit 1bcbc70

Please sign in to comment.