diff --git a/src/node.cc b/src/node.cc index 6b095a6f5816b6..074589542f59ba 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1177,11 +1177,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) {