Skip to content

Commit

Permalink
src: remove unnecessary ToLocalChecked node_errors
Browse files Browse the repository at this point in the history
PR-URL: #36547
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
danbev authored and targos committed Dec 22, 2020
1 parent 19c2332 commit d38a0ec
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/node_errors.cc
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ void TriggerUncaughtException(Isolate* isolate,
return;
}

MaybeLocal<Value> handled;
MaybeLocal<Value> maybe_handled;
if (env->can_call_into_js()) {
// We do not expect the global uncaught exception itself to throw any more
// exceptions. If it does, exit the current Node.js instance.
Expand All @@ -968,15 +968,16 @@ void TriggerUncaughtException(Isolate* isolate,
Local<Value> argv[2] = { error,
Boolean::New(env->isolate(), from_promise) };

handled = fatal_exception_function.As<Function>()->Call(
maybe_handled = fatal_exception_function.As<Function>()->Call(
env->context(), process_object, arraysize(argv), argv);
}

// If process._fatalException() throws, we are now exiting the Node.js
// instance so return to continue the exit routine.
// TODO(joyeecheung): return a Maybe here to prevent the caller from
// stepping on the exit.
if (handled.IsEmpty()) {
Local<Value> handled;
if (!maybe_handled.ToLocal(&handled)) {
return;
}

Expand All @@ -986,7 +987,7 @@ void TriggerUncaughtException(Isolate* isolate,
// TODO(joyeecheung): This has been only checking that the return value is
// exactly false. Investigate whether this can be turned to an "if true"
// similar to how the worker global uncaught exception handler handles it.
if (!handled.ToLocalChecked()->IsFalse()) {
if (!handled->IsFalse()) {
return;
}

Expand Down

0 comments on commit d38a0ec

Please sign in to comment.