| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
@BridgeAR build started: https://ci.nodejs.org/blue/organizations/jenkins/node-test-pull-request-lite-pipeline/detail/node-test-pull-request-lite-pipeline/2871/pipeline |
Sorry, something went wrong.
|
Code changes and proposed modes LGTM. If you don't mind, I want to investigate how this works with postmortem/llnode before we land. I'm not sure calling process.abort() is the best approach in this case and I think the stackTraceLimit reset trick to speed up Error creation might interfere with recent developments to make llnode more useful when investigating unhandled promise rejections (see https://chromium-review.googlesource.com/c/v8/v8/+/1405568 and nodejs/llnode#271). |
Sorry, something went wrong.
There was a problem hiding this comment.
Although I'd still prefer the deprecation warning be removed in the default case, I'm glad it's removed when an explicit flag is passed.
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
|
I had to rebase due to conflicts, so PTAL. |
Sorry, something went wrong.
|
From a postmortem/llnode perspective (with the flags --unhandled-rejections=strict and --abort-on-uncaught-exception set):
|
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM, the only thing I think we should change is on V8 and not on Node.js, so I'll open an upstream PR for that.
Edit: Upstream PR, if anyone is interested: https://chromium-review.googlesource.com/c/v8/v8/+/1518612
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM once the default behaviour is clarified.
Sorry, something went wrong.
|
I improved the documentation and the warn I reworked the warn mode a tiny bit: it will now always warn (but without the deprecation notice), even if there is an unhandled rejections on in place. |
Sorry, something went wrong.
|
@BridgeAR so to clarify, warn doesn't show the deprecation warning and it ignores handlers (assuming they don't actually handle the rejection) and the default did not change? |
Sorry, something went wrong.
Exactly
That's a good point. I forgot that they might actually add a handler. I'll add a fix for that so I verify that the promise is indeed still unhandled before printing the warning.
There is absolutely no behavior change if non of the flags is used. That is one of the goals with this PR. |
Sorry, something went wrong.
|
Thinking about it again: I would rather always warn, even if the unhandled rejection hook attached a handler. Otherwise it would a) be possible to silence those warnings with the hook which I think is orthogonal to what the user wants if they use the warn mode and b) it increases the complexity for the implementation (I have to wait another tick and add extra information and then check if it got handled in the meanwhile). |
Sorry, something went wrong.
There was a problem hiding this comment.
Explicit "still lgtm"
Sorry, something went wrong.
Sorry, something went wrong.
|
CI https://ci.nodejs.org/job/node-test-pull-request/21570/ @mmarchini @mcollina @mhdawson @benjamingr would you be so kind and confirm your LG? To me this seems ready to land. |
Sorry, something went wrong.
There was a problem hiding this comment.
Still seems good to me!
Perhaps could this flag be set by an environment variable? That way it would be able to affect shebangs in files, or nested node commands i might not be able to edit.
Sorry, something went wrong.
This adds a flag to define the default behavior for unhandled rejections. Three modes exist: `none`, `warn` and `strict`. The first is going to silence all unhandled rejection warnings. The second behaves identical to the current default with the excetion that no deprecation warning will be printed and the last is going to throw an error for each unhandled rejection, just as regular exceptions do. It is possible to intercept those with the `uncaughtException` hook as with all other exceptions as well. This PR has no influence on the existing `unhandledRejection` hook. If that is used, it will continue to function as before. PR-URL: nodejs#26599 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Matheus Marchini <mat@mmarchini.me> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This adds a flag to define the default behavior for unhandled rejections. Three modes exist: `none`, `warn` and `strict`. The first is going to silence all unhandled rejection warnings. The second behaves identical to the current default with the excetion that no deprecation warning will be printed and the last is going to throw an error for each unhandled rejection, just as regular exceptions do. It is possible to intercept those with the `uncaughtException` hook as with all other exceptions as well. This PR has no influence on the existing `unhandledRejection` hook. If that is used, it will continue to function as before. PR-URL: #26599 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Matheus Marchini <mat@mmarchini.me> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Notable changes:
* crypto:
* add support for chacha20-poly1305 for AEAD (chux0519)
#24081
* increase maxmem range from 32 to 53 bits (Tobias Nießen)
#28799
* deps:
* update npm to 6.11.3 (claudiahdz)
#29430
* upgrade openssl sources to 1.1.1d (Sam Roberts)
#29921
* dns:
* remove dns.promises experimental warning (cjihrig)
#26592
* fs:
* remove experimental warning for fs.promises (Anna Henningsen)
#26581
* http:
* makes response.writeHead return the response (Mark S. Everitt)
#25974
* http2:
* makes response.writeHead return the response (Mark S. Everitt)
#25974
* n-api:
* make func argument of napi\_create\_threadsafe\_function optional
(legendecas)
#27791
* mark version 5 N-APIs as stable (Gabriel Schulhof)
#29401
* implement date object (Jarrod Connolly)
#25917
* process:
* add --unhandled-rejections flag (Ruben Bridgewater)
#26599
* stream:
* implement Readable.from async iterator utility (Guy Bedford)
#27660
* make Symbol.asyncIterator support stable (Matteo Collina)
#26989
PR-URL: #29875
Notable changes:
* crypto:
* add support for chacha20-poly1305 for AEAD (chux0519)
#24081
* increase maxmem range from 32 to 53 bits (Tobias Nießen)
#28799
* deps:
* update npm to 6.11.3 (claudiahdz)
#29430
* upgrade openssl sources to 1.1.1d (Sam Roberts)
#29921
* dns:
* remove dns.promises experimental warning (cjihrig)
#26592
* fs:
* remove experimental warning for fs.promises (Anna Henningsen)
#26581
* http:
* makes response.writeHead return the response (Mark S. Everitt)
#25974
* http2:
* makes response.writeHead return the response (Mark S. Everitt)
#25974
* n-api:
* make func argument of napi\_create\_threadsafe\_function optional
(legendecas)
#27791
* mark version 5 N-APIs as stable (Gabriel Schulhof)
#29401
* implement date object (Jarrod Connolly)
#25917
* process:
* add --unhandled-rejections flag (Ruben Bridgewater)
#26599
* stream:
* implement Readable.from async iterator utility (Guy Bedford)
#27660
* make Symbol.asyncIterator support stable (Matteo Collina)
#26989
PR-URL: #29875
--unhandled-rejections has three explicit modes (strict, warn, none) plus one implicit "default" mode, which logs an additional deprecation warning (DEP0018). Prior to this commit, the default mode was subtly different from warn mode. If the unhandledRejections hook is set, default mode suppresses all warnings. In warn mode, unhandledRejections would always fire a warning, regardless of whether the hook was set. In addition, prior to this commit, strict mode would always throw an exception, regardless of whether the hook was set. In this commit, all modes honor the unhandledRejections hook. If the user has set the hook, then the user has taken full responsibility over the behavior of unhandled rejections. In that case, no additional warnings or thrown exceptions will be fired, even in warn mode or strict mode. This commit is a stepping stone towards resolving DEP0018. After this commit, any code that includes an unhandledRejection hook will behave unchanged when we change the default mode. Refs: nodejs#26599
| Back | FazBrowse Home | New Git URL |
This adds a flag to define the default behavior for unhandled
rejections. Three modes exist: none, warn and strict. The first
is going to silence all unhandled rejection warnings. The second
behaves identical to the current default with the excetion that no
deprecation warning will be printed and the last is going to throw
an error for each unhandled rejection, just as regular exceptions do.
It is possible to intercept those with the uncaughtException hook
as with all other exceptions as well.
This PR has no influence on the existing unhandledRejection hook.
If that is used, it will continue to function as before.
Supersedes #20097
// CC @nodejs/diagnostics @nodejs/promises-debugging @nodejs/tsc
Checklist