diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-01-27 16:19:16 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-01-29 22:01:59 +0300 |
commit | 4dbff090c3ff2ba43b0fbb06cc65bef5b5d81008 (patch) | |
tree | 92056e30acb45bbb14fcca733e901d5d37a7fa3c /src/udp_wrap.cc | |
parent | 55569759b32b61a94c57283e2030e737ae06c860 (diff) |
src: pass along errors from stream obj instantiation
PR-URL: https://github.com/nodejs/node/pull/25734
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Diffstat (limited to 'src/udp_wrap.cc')
-rw-r--r-- | src/udp_wrap.cc | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc index d838ef6e725..e4aca28c895 100644 --- a/src/udp_wrap.cc +++ b/src/udp_wrap.cc @@ -30,12 +30,12 @@ namespace node { using v8::Array; using v8::Context; -using v8::EscapableHandleScope; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; using v8::HandleScope; using v8::Integer; using v8::Local; +using v8::MaybeLocal; using v8::Object; using v8::PropertyAttribute; using v8::Signature; @@ -518,18 +518,14 @@ void UDPWrap::OnRecv(uv_udp_t* handle, wrap->MakeCallback(env->onmessage_string(), arraysize(argv), argv); } - -Local<Object> UDPWrap::Instantiate(Environment* env, - AsyncWrap* parent, - UDPWrap::SocketType type) { - EscapableHandleScope scope(env->isolate()); +MaybeLocal<Object> UDPWrap::Instantiate(Environment* env, + AsyncWrap* parent, + UDPWrap::SocketType type) { AsyncHooks::DefaultTriggerAsyncIdScope trigger_scope(parent); // If this assert fires then Initialize hasn't been called yet. CHECK_EQ(env->udp_constructor_function().IsEmpty(), false); - Local<Object> instance = env->udp_constructor_function() - ->NewInstance(env->context()).ToLocalChecked(); - return scope.Escape(instance); + return env->udp_constructor_function()->NewInstance(env->context()); } |