Skip to content

Commit 732780f

Browse files
aduh95targos
authored andcommitted
process: refs --unhandled-rejections documentation in warning message
Refs: #20392 PR-URL: #30564 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 5537fae commit 732780f

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

lib/internal/process/promises.js

+3
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ function emitUnhandledRejectionWarning(uid, reason) {
134134
'Unhandled promise rejection. This error originated either by ' +
135135
'throwing inside of an async function without a catch block, ' +
136136
'or by rejecting a promise which was not handled with .catch(). ' +
137+
'To terminate the node process on unhandled promise ' +
138+
'rejection, use the CLI flag `--unhandled-rejections=strict` (see ' +
139+
'https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). ' +
137140
`(rejection id: ${uid})`
138141
);
139142
try {

test/parallel/test-promises-unhandled-proxy-rejections.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ const expectedPromiseWarning = ['Unhandled promise rejection. ' +
1212
'This error originated either by throwing ' +
1313
'inside of an async function without a catch ' +
1414
'block, or by rejecting a promise which was ' +
15-
'not handled with .catch(). (rejection id: 1)'];
15+
'not handled with .catch(). To terminate the ' +
16+
'node process on unhandled promise rejection, ' +
17+
'use the CLI flag `--unhandled-rejections=strict` (see ' +
18+
'https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)'];
1619

1720
function throwErr() {
1821
throw new Error('Error from proxy');

test/parallel/test-promises-unhandled-symbol-rejections.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ const expectedPromiseWarning = ['Unhandled promise rejection. ' +
1313
'This error originated either by throwing ' +
1414
'inside of an async function without a catch ' +
1515
'block, or by rejecting a promise which was ' +
16-
'not handled with .catch(). (rejection id: 1)'];
16+
'not handled with .catch(). To terminate the ' +
17+
'node process on unhandled promise rejection, ' +
18+
'use the CLI flag `--unhandled-rejections=strict` (see ' +
19+
'https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)'];
1720

1821
common.expectWarning({
1922
DeprecationWarning: expectedDeprecationWarning,

0 commit comments

Comments
 (0)