fix: TryCatch
scope in node_bindings (#35850)
fix: TryCatch scope in node_bindings
This commit is contained in:
parent
16f459228b
commit
c76a931e20
1 changed files with 15 additions and 12 deletions
|
@ -492,19 +492,22 @@ node::Environment* NodeBindings::CreateEnvironment(
|
||||||
flags |= node::EnvironmentFlags::kNoStartDebugSignalHandler;
|
flags |= node::EnvironmentFlags::kNoStartDebugSignalHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
v8::TryCatch try_catch(isolate);
|
{
|
||||||
env = node::CreateEnvironment(
|
v8::TryCatch try_catch(isolate);
|
||||||
isolate_data_, context, args, exec_args,
|
env = node::CreateEnvironment(
|
||||||
static_cast<node::EnvironmentFlags::Flags>(flags));
|
isolate_data_, context, args, exec_args,
|
||||||
|
static_cast<node::EnvironmentFlags::Flags>(flags));
|
||||||
|
|
||||||
if (try_catch.HasCaught()) {
|
if (try_catch.HasCaught()) {
|
||||||
std::string err_msg =
|
std::string err_msg =
|
||||||
"Failed to initialize node environment in process: " + process_type;
|
"Failed to initialize node environment in process: " + process_type;
|
||||||
v8::Local<v8::Message> message = try_catch.Message();
|
v8::Local<v8::Message> message = try_catch.Message();
|
||||||
std::string msg;
|
std::string msg;
|
||||||
if (!message.IsEmpty() && gin::ConvertFromV8(isolate, message->Get(), &msg))
|
if (!message.IsEmpty() &&
|
||||||
err_msg += " , with error: " + msg;
|
gin::ConvertFromV8(isolate, message->Get(), &msg))
|
||||||
LOG(ERROR) << err_msg;
|
err_msg += " , with error: " + msg;
|
||||||
|
LOG(ERROR) << err_msg;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DCHECK(env);
|
DCHECK(env);
|
||||||
|
|
Loading…
Reference in a new issue