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;
|
||||
}
|
||||
|
||||
v8::TryCatch try_catch(isolate);
|
||||
env = node::CreateEnvironment(
|
||||
isolate_data_, context, args, exec_args,
|
||||
static_cast<node::EnvironmentFlags::Flags>(flags));
|
||||
{
|
||||
v8::TryCatch try_catch(isolate);
|
||||
env = node::CreateEnvironment(
|
||||
isolate_data_, context, args, exec_args,
|
||||
static_cast<node::EnvironmentFlags::Flags>(flags));
|
||||
|
||||
if (try_catch.HasCaught()) {
|
||||
std::string err_msg =
|
||||
"Failed to initialize node environment in process: " + process_type;
|
||||
v8::Local<v8::Message> message = try_catch.Message();
|
||||
std::string msg;
|
||||
if (!message.IsEmpty() && gin::ConvertFromV8(isolate, message->Get(), &msg))
|
||||
err_msg += " , with error: " + msg;
|
||||
LOG(ERROR) << err_msg;
|
||||
if (try_catch.HasCaught()) {
|
||||
std::string err_msg =
|
||||
"Failed to initialize node environment in process: " + process_type;
|
||||
v8::Local<v8::Message> message = try_catch.Message();
|
||||
std::string msg;
|
||||
if (!message.IsEmpty() &&
|
||||
gin::ConvertFromV8(isolate, message->Get(), &msg))
|
||||
err_msg += " , with error: " + msg;
|
||||
LOG(ERROR) << err_msg;
|
||||
}
|
||||
}
|
||||
|
||||
DCHECK(env);
|
||||
|
|
Loading…
Reference in a new issue