-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
unhandledRejection fails to occur if .catch()
is used on the last promise
#30953
Labels
Comments
addaleax
added
confirmed-bug
Issues with confirmed bugs.
promises
Issues and PRs related to ECMAScript promises.
labels
Dec 13, 2019
Something like this might help? diff --git a/lib/internal/process/promises.js b/lib/internal/process/promises.js
index 35ebb39115f3..7cd40f96cc98 100644
--- a/lib/internal/process/promises.js
+++ b/lib/internal/process/promises.js
@@ -125,7 +125,8 @@ function handledRejection(promise) {
return;
}
}
- setHasRejectionToWarn(false);
+ if (maybeUnhandledPromises.size === 0 && asyncHandledRejections.length === 0)
+ setHasRejectionToWarn(false);
}
const unhandledRejectionErrName = 'UnhandledPromiseRejectionWarning'; @nodejs/promises-debugging @joyeecheung (I think this might have come from bf56671) |
@addaleax Yeah, that’s likely, as the PR only passed whatever test we had and this does not seem to be tested by us. |
MylesBorins
pushed a commit
that referenced
this issue
Dec 17, 2019
Fixes: #30953 PR-URL: #30957 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
targos
pushed a commit
that referenced
this issue
Jan 14, 2020
Fixes: #30953 PR-URL: #30957 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
BethGriggs
pushed a commit
that referenced
this issue
Feb 6, 2020
Fixes: #30953 PR-URL: #30957 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Linux lt2.cfware.com 5.3.11-200.fc30.x86_64 #1 SMP Tue Nov 12 19:25:25 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Take the following script:
The expected result is an unhandledRejection for
rejection 1
. This script produces no warnings on node.js 12 or 13.The text was updated successfully, but these errors were encountered: