Skip to content

Commit 31e4a0d

Browse files
HarshithaKPMylesBorins
authored andcommitted
src: Handle bad callback in asyc_wrap
Align with the MaybeLocal<> API contract PR-URL: #31946 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 6122620 commit 31e4a0d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/async_wrap-inl.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,8 @@ inline v8::MaybeLocal<v8::Value> AsyncWrap::MakeCallback(
7474
if (!object()->Get(env()->context(), symbol).ToLocal(&cb_v))
7575
return v8::MaybeLocal<v8::Value>();
7676
if (!cb_v->IsFunction()) {
77-
// TODO(addaleax): We should throw an error here to fulfill the
78-
// `MaybeLocal<>` API contract.
79-
return v8::MaybeLocal<v8::Value>();
77+
v8::Isolate* isolate = env()->isolate();
78+
return Undefined(isolate);
8079
}
8180
return MakeCallback(cb_v.As<v8::Function>(), argc, argv);
8281
}

0 commit comments

Comments
 (0)