diff --git a/src/node.cc b/src/node.cc index 9d48581d5f29e8..e869a9ee724f04 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1187,11 +1187,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) {