src: refactor uncaught exception handling#28257
Closed
joyeecheung wants to merge 2 commits intonodejs:masterfrom
Closed
src: refactor uncaught exception handling#28257joyeecheung wants to merge 2 commits intonodejs:masterfrom
joyeecheung wants to merge 2 commits intonodejs:masterfrom
Conversation
The C++ land `node::FatalException()` is not in fact fatal anymore. It gives the user a chance to handle the uncaught exception globally by listening to the `uncaughtException` event. This patch renames it to `TriggerUncaughtException` in C++ to avoid the confusion. In addition rename the JS land handler to `onGlobalUncaughtException` to reflect its purpose - we have to keep the alias `process._fatalException` and use that for now since it has been monkey-patchable in the user land. This patch also - Adds more comments to the global uncaught exception handling routine - Puts a few other C++ error handling functions into the `errors` namespace - Moves error-handling-related bindings to the `errors` binding. Refs: nodejs@2b252ac
Collaborator
|
Sadly, an error occurred when I tried to trigger a build. :( |
joyeecheung
commented
Jun 17, 2019
| triggerFatalException(error, false /* fromPromise */); | ||
| // runInAsyncScope() swallows the error so we need to catch | ||
| // it and handle it here. | ||
| triggerUncaughtException(error, false /* fromPromise */); |
Member
Author
There was a problem hiding this comment.
@devsnek I tried a cctest on V8 master and it seems the issue still exist. However we still need to catch the error even when it's fixed since runInAsyncScope() will swallow the error.
addaleax
reviewed
Jun 17, 2019
Collaborator
addaleax
approved these changes
Jun 17, 2019
Collaborator
Member
Author
|
cc @nodejs/process |
benjamingr
approved these changes
Jun 18, 2019
fhinkel
approved these changes
Jun 19, 2019
joyeecheung
added a commit
that referenced
this pull request
Jun 19, 2019
The C++ land `node::FatalException()` is not in fact fatal anymore. It gives the user a chance to handle the uncaught exception globally by listening to the `uncaughtException` event. This patch renames it to `TriggerUncaughtException` in C++ to avoid the confusion. In addition rename the JS land handler to `onGlobalUncaughtException` to reflect its purpose - we have to keep the alias `process._fatalException` and use that for now since it has been monkey-patchable in the user land. This patch also - Adds more comments to the global uncaught exception handling routine - Puts a few other C++ error handling functions into the `errors` namespace - Moves error-handling-related bindings to the `errors` binding. Refs: 2b252ac PR-URL: #28257 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Member
Author
|
Landed in a33c3c6 |
targos
pushed a commit
that referenced
this pull request
Jul 2, 2019
The C++ land `node::FatalException()` is not in fact fatal anymore. It gives the user a chance to handle the uncaught exception globally by listening to the `uncaughtException` event. This patch renames it to `TriggerUncaughtException` in C++ to avoid the confusion. In addition rename the JS land handler to `onGlobalUncaughtException` to reflect its purpose - we have to keep the alias `process._fatalException` and use that for now since it has been monkey-patchable in the user land. This patch also - Adds more comments to the global uncaught exception handling routine - Puts a few other C++ error handling functions into the `errors` namespace - Moves error-handling-related bindings to the `errors` binding. Refs: 2b252ac PR-URL: #28257 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
This was referenced Jul 3, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The C++ land
node::FatalException()is not in fact fatal anymore.It gives the user a chance to handle the uncaught exception
globally by listening to the
uncaughtExceptionevent. This patchrenames it to
TriggerUncaughtExceptionin C++ to avoid the confusion.In addition rename the JS land handler to
onGlobalUncaughtExceptionto reflect its purpose - we have to keep the alias
process._fatalExceptionand use that for now since it has beenmonkey-patchable in the user land.
This patch also
errorsnamespace
errorsbinding.Refs: 2b252ac
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes