src: reword command and add ternary

Make comment clear that Undefined() is returned for legacy
compatibility. This will change in the future as a semver-major change,
but to be able to port this to previous releases it needs to stay as is.

PR-URL: https://github.com/nodejs/node/pull/5756
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
This commit is contained in:
Trevor Norris 2016-03-23 17:02:04 -06:00
parent 41f333e679
commit 2dadd8901a

View File

@ -1205,11 +1205,10 @@ Local<Value> MakeCallback(Environment* env,
} }
if (ret.IsEmpty()) { if (ret.IsEmpty()) {
if (callback_scope.in_makecallback()) // NOTE: For backwards compatibility with public API we return Undefined()
return ret; // if the top level call threw.
// NOTE: Undefined() is returned here for backwards compatibility. return callback_scope.in_makecallback() ?
else ret : Undefined(env->isolate()).As<Value>();
return Undefined(env->isolate());
} }
if (has_domain) { if (has_domain) {