Skip to content

Commit

Permalink
src: reword command and add ternary
Browse files Browse the repository at this point in the history
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: #5756
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Andreas Madsen <[email protected]>
  • Loading branch information
trevnorris authored and evanlucas committed Mar 30, 2016
1 parent f1488bb commit f9d0166
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1187,11 +1187,10 @@ Local<Value> 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<Value>();
}

if (has_domain) {
Expand Down

0 comments on commit f9d0166

Please sign in to comment.