diff options
author | Dan Fabulich <dan@fabulich.com> | 2020-05-20 03:41:01 +0300 |
---|---|---|
committer | Matheus Marchini <mmarchini@netflix.com> | 2020-06-16 23:03:05 +0300 |
commit | ff74e35c0bfc206fdbac21b5df61edf860a3267b (patch) | |
tree | bde350e251542e32d19d94dce4d38b94f14476c5 /src/node_options.cc | |
parent | bc71278563b60caba7e2d39c170d439a205ff529 (diff) |
process: add unhandled-rejection throw and warn-with-error-code
This PR defines two new modes for the --unhandled-rejections flag.
The first mode is called "throw". The "throw" mode first emits
unhandledRejection. If this hook is not set, the "throw" mode will
raise the unhandled rejection as an uncaught exception.
The second mode is called "warn-with-error-code". The
"warn-with-error-code" mode first emits unhandledRejection. If this
hook is not set, the "warn-with-error-code" mode will trigger a
warning and set the process's exit code to 1.
The PR doesn't change the default behavior for unhandled rejections.
That will come in a separate PR.
Refs: https://github.com/nodejs/node/pull/33021
PR-URL: https://github.com/nodejs/node/pull/33475
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/node_options.cc')
-rw-r--r-- | src/node_options.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/node_options.cc b/src/node_options.cc index fb730975761..d7434b4b124 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -118,6 +118,8 @@ void EnvironmentOptions::CheckOptions(std::vector<std::string>* errors) { } if (!unhandled_rejections.empty() && + unhandled_rejections != "warn-with-error-code" && + unhandled_rejections != "throw" && unhandled_rejections != "strict" && unhandled_rejections != "warn" && unhandled_rejections != "none") { |