Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: handle bad callback in asyc_wrap #31946

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
src: Handle bad callback in asyc_wrap
Align with the MaybeLocal<> API contract
  • Loading branch information
HarshithaKP committed Feb 27, 2020
commit fc53c8d524452f38ef59e41ad40fd903c5bb08ca
6 changes: 3 additions & 3 deletions src/async_wrap-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include "async_wrap.h"
#include "base_object-inl.h"
#include "node_errors.h"
addaleax marked this conversation as resolved.
Show resolved Hide resolved
#include "node_internals.h"

namespace node {
Expand Down Expand Up @@ -74,9 +75,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