Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: remove unnecessary ToLocalChecked node_errors #36547

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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