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/tcp_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/tcp_wrap.cc')
-rw-r--r-- | src/tcp_wrap.cc | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc index dac621ec879..cb6e6340067 100644 --- a/src/tcp_wrap.cc +++ b/src/tcp_wrap.cc @@ -46,6 +46,7 @@ using v8::HandleScope; using v8::Int32; using v8::Integer; using v8::Local; +using v8::MaybeLocal; using v8::Object; using v8::String; using v8::Uint32; @@ -53,10 +54,9 @@ using v8::Value; using AsyncHooks = Environment::AsyncHooks; - -Local<Object> TCPWrap::Instantiate(Environment* env, - AsyncWrap* parent, - TCPWrap::SocketType type) { +MaybeLocal<Object> TCPWrap::Instantiate(Environment* env, + AsyncWrap* parent, + TCPWrap::SocketType type) { EscapableHandleScope handle_scope(env->isolate()); AsyncHooks::DefaultTriggerAsyncIdScope trigger_scope(parent); CHECK_EQ(env->tcp_constructor_template().IsEmpty(), false); @@ -65,9 +65,8 @@ Local<Object> TCPWrap::Instantiate(Environment* env, .ToLocalChecked(); CHECK_EQ(constructor.IsEmpty(), false); Local<Value> type_value = Int32::New(env->isolate(), type); - Local<Object> instance = - constructor->NewInstance(env->context(), 1, &type_value).ToLocalChecked(); - return handle_scope.Escape(instance); + return handle_scope.EscapeMaybe( + constructor->NewInstance(env->context(), 1, &type_value)); } |