Skip to content

Commit

Permalink
src: Handle bad callback in asyc_wrap
Browse files Browse the repository at this point in the history
Align with the MaybeLocal<> API contract

PR-URL: #31946
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
HarshithaKP authored and codebytere committed Mar 30, 2020
1 parent 05fbc80 commit 808379c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/async_wrap-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 808379c

Please sign in to comment.