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 <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
danbev authored and targos committed May 1, 2021
1 parent 5ac21bc commit c308b06
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 @@ -945,7 +945,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 @@ -959,15 +959,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 @@ -977,7 +978,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 c308b06

Please sign in to comment.