diff --git a/src/node_wasi.cc b/src/node_wasi.cc index 80182724afea9c..4dd534af4167ee 100644 --- a/src/node_wasi.cc +++ b/src/node_wasi.cc @@ -104,9 +104,9 @@ static MaybeLocal WASIException(Local context, js_msg = String::Concat(isolate, js_msg, FIXED_ONE_BYTE_STRING(isolate, ", ")); js_msg = String::Concat(isolate, js_msg, js_syscall); - Local e = - Exception::Error(js_msg)->ToObject(context) - .ToLocalChecked(); + Local e; + if (!Exception::Error(js_msg)->ToObject(context).ToLocal(&e)) + return MaybeLocal(); if (e->Set(context, env->errno_string(), @@ -128,13 +128,11 @@ WASI::WASI(Environment* env, options->allocator = &alloc_info_; int err = uvwasi_init(&uvw_, options); if (err != UVWASI_ESUCCESS) { - Local context = env->context(); - MaybeLocal exception = WASIException(context, err, "uvwasi_init"); - - if (exception.IsEmpty()) + Local exception; + if (!WASIException(env->context(), err, "uvwasi_init").ToLocal(&exception)) return; - context->GetIsolate()->ThrowException(exception.ToLocalChecked()); + env->isolate()->ThrowException(exception); } } diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc index 9e6831b2ed3b04..1396395463dfed 100644 --- a/src/pipe_wrap.cc +++ b/src/pipe_wrap.cc @@ -40,7 +40,6 @@ using v8::Function; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; using v8::Int32; -using v8::Isolate; using v8::Local; using v8::MaybeLocal; using v8::Object; @@ -216,9 +215,8 @@ void PipeWrap::Open(const FunctionCallbackInfo& args) { int err = uv_pipe_open(&wrap->handle_, fd); wrap->set_fd(fd); - Isolate* isolate = env->isolate(); if (err != 0) - isolate->ThrowException(UVException(isolate, err, "uv_pipe_open")); + env->ThrowUVException(err, "uv_pipe_open"); }