diff options
author | Harshitha KP <harshi46@in.ibm.com> | 2020-02-25 02:46:16 -0500 |
---|---|---|
committer | Gireesh Punathil <gpunathi@in.ibm.com> | 2020-03-05 12:30:29 +0530 |
commit | 757e2037e74fecca521c664fc8486596b306de39 (patch) | |
tree | 222edb0ef0ed076fb0412155326f2538e67d87f7 /src/async_wrap-inl.h | |
parent | cb8898c48feac55ef49b1594d7a4131e827c213e (diff) | |
download | node-new-757e2037e74fecca521c664fc8486596b306de39.tar.gz |
src: Handle bad callback in asyc_wrap
Align with the MaybeLocal<> API contract
PR-URL: https://github.com/nodejs/node/pull/31946
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/async_wrap-inl.h')
-rw-r--r-- | src/async_wrap-inl.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/async_wrap-inl.h b/src/async_wrap-inl.h index e3e48666e4..03745081f3 100644 --- a/src/async_wrap-inl.h +++ b/src/async_wrap-inl.h @@ -74,9 +74,8 @@ inline v8::MaybeLocal<v8::Value> AsyncWrap::MakeCallback( if (!object()->Get(env()->context(), symbol).ToLocal(&cb_v)) return v8::MaybeLocal<v8::Value>(); if (!cb_v->IsFunction()) { - // TODO(addaleax): We should throw an error here to fulfill the - // `MaybeLocal<>` API contract. - return v8::MaybeLocal<v8::Value>(); + v8::Isolate* isolate = env()->isolate(); + return Undefined(isolate); } return MakeCallback(cb_v.As<v8::Function>(), argc, argv); } |