summaryrefslogtreecommitdiff
path: root/src/node_contextify.cc
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2019-06-15 08:07:15 +0800
committerJoyee Cheung <joyeec9h3@gmail.com>2019-06-19 16:16:37 +0800
commita33c3c6d33fa81fa59a5aa95246d7f599e6abdd3 (patch)
tree16ee1009fda3317f5cdf3f8b80491f6b84b03d3e /src/node_contextify.cc
parent1c23b6f2bec82904aacfff279f0e2776246b6da4 (diff)
downloadandroid-node-v8-a33c3c6d33fa81fa59a5aa95246d7f599e6abdd3.tar.gz
android-node-v8-a33c3c6d33fa81fa59a5aa95246d7f599e6abdd3.tar.bz2
android-node-v8-a33c3c6d33fa81fa59a5aa95246d7f599e6abdd3.zip
src: refactor uncaught exception handling
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: https://github.com/nodejs/node/commit/2b252acea47af3ebeac3d7e68277f015667264cc PR-URL: https://github.com/nodejs/node/pull/28257 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Diffstat (limited to 'src/node_contextify.cc')
-rw-r--r--src/node_contextify.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/node_contextify.cc b/src/node_contextify.cc
index ee5a9db574..70c63a0d8a 100644
--- a/src/node_contextify.cc
+++ b/src/node_contextify.cc
@@ -734,7 +734,7 @@ void ContextifyScript::New(const FunctionCallbackInfo<Value>& args) {
compile_options);
if (v8_script.IsEmpty()) {
- DecorateErrorStack(env, try_catch);
+ errors::DecorateErrorStack(env, try_catch);
no_abort_scope.Close();
if (!try_catch.HasTerminated())
try_catch.ReThrow();
@@ -946,7 +946,7 @@ bool ContextifyScript::EvalMachine(Environment* env,
if (try_catch.HasCaught()) {
if (!timed_out && !received_signal && display_errors) {
// We should decorate non-termination exceptions
- DecorateErrorStack(env, try_catch);
+ errors::DecorateErrorStack(env, try_catch);
}
// If there was an exception thrown during script execution, re-throw it.
@@ -1110,7 +1110,7 @@ void ContextifyContext::CompileFunction(
if (maybe_fn.IsEmpty()) {
if (try_catch.HasCaught() && !try_catch.HasTerminated()) {
- DecorateErrorStack(env, try_catch);
+ errors::DecorateErrorStack(env, try_catch);
try_catch.ReThrow();
}
return;