diff --git a/src/node.cc b/src/node.cc index ca923585e0..bccb4f78a7 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1205,11 +1205,10 @@ Local MakeCallback(Environment* env, } if (ret.IsEmpty()) { - if (callback_scope.in_makecallback()) - return ret; - // NOTE: Undefined() is returned here for backwards compatibility. - else - return Undefined(env->isolate()); + // NOTE: For backwards compatibility with public API we return Undefined() + // if the top level call threw. + return callback_scope.in_makecallback() ? + ret : Undefined(env->isolate()).As(); } if (has_domain) {