diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-01-30 21:15:58 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-02-08 23:03:56 +0300 |
commit | 8b79c15b6f82c79c35bf57927342ac8e44e1e4b7 (patch) | |
tree | 812470e15a1c3e3a7fccf05ee648e34538715068 /src/stream_base-inl.h | |
parent | 63d398c9bbf94e1d5da7f287473137234353c622 (diff) |
src: pass along errors from StreamBase req obj creations
PR-URL: https://github.com/nodejs/node/pull/25822
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Diffstat (limited to 'src/stream_base-inl.h')
-rw-r--r-- | src/stream_base-inl.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/stream_base-inl.h b/src/stream_base-inl.h index 7e2bbaa1730..7db8403ced8 100644 --- a/src/stream_base-inl.h +++ b/src/stream_base-inl.h @@ -163,9 +163,11 @@ inline int StreamBase::Shutdown(v8::Local<v8::Object> req_wrap_obj) { HandleScope handle_scope(env->isolate()); if (req_wrap_obj.IsEmpty()) { - req_wrap_obj = - env->shutdown_wrap_template() - ->NewInstance(env->context()).ToLocalChecked(); + if (!env->shutdown_wrap_template() + ->NewInstance(env->context()) + .ToLocal(&req_wrap_obj)) { + return UV_EBUSY; + } StreamReq::ResetObject(req_wrap_obj); } @@ -211,9 +213,11 @@ inline StreamWriteResult StreamBase::Write( HandleScope handle_scope(env->isolate()); if (req_wrap_obj.IsEmpty()) { - req_wrap_obj = - env->write_wrap_template() - ->NewInstance(env->context()).ToLocalChecked(); + if (!env->write_wrap_template() + ->NewInstance(env->context()) + .ToLocal(&req_wrap_obj)) { + return StreamWriteResult { false, UV_EBUSY, nullptr, 0 }; + } StreamReq::ResetObject(req_wrap_obj); } |