summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTrevor Norris <trev.norris@gmail.com>2016-03-23 17:02:04 -0600
committerTrevor Norris <trev.norris@gmail.com>2016-03-28 11:32:29 -0600
commit2dadd8901a85a3e100e8a907b1b64c45dd59eb5a (patch)
tree4dae6e174ffabe281a1421e5f46266351916f684 /src
parent41f333e67949dec26cad3cb8c0bcea686164819b (diff)
downloadandroid-node-v8-2dadd8901a85a3e100e8a907b1b64c45dd59eb5a.tar.gz
android-node-v8-2dadd8901a85a3e100e8a907b1b64c45dd59eb5a.tar.bz2
android-node-v8-2dadd8901a85a3e100e8a907b1b64c45dd59eb5a.zip
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>
Diffstat (limited to 'src')
-rw-r--r--src/node.cc9
1 files changed, 4 insertions, 5 deletions
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<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) {