diff --git a/src/api/environment.cc b/src/api/environment.cc index 2b7a7023b5f33c..99b185798a7f9e 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc @@ -51,17 +51,11 @@ static MaybeLocal PrepareStackTraceCallback(Local context, Local trace) { Environment* env = Environment::GetCurrent(context); if (env == nullptr) { - MaybeLocal s = exception->ToString(context); - return s.IsEmpty() ? - MaybeLocal() : - MaybeLocal(s.ToLocalChecked()); + return exception->ToString(context).FromMaybe(Local()); } Local prepare = env->prepare_stack_trace_callback(); if (prepare.IsEmpty()) { - MaybeLocal s = exception->ToString(context); - return s.IsEmpty() ? - MaybeLocal() : - MaybeLocal(s.ToLocalChecked()); + return exception->ToString(context).FromMaybe(Local()); } Local args[] = { context->Global(),