Skip to content

Commit f9d0166

Browse files
trevnorrisevanlucas
authored andcommitted
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: #5756 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
1 parent f1488bb commit f9d0166

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/node.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,11 +1187,10 @@ Local<Value> MakeCallback(Environment* env,
11871187
}
11881188

11891189
if (ret.IsEmpty()) {
1190-
if (callback_scope.in_makecallback())
1191-
return ret;
1192-
// NOTE: Undefined() is returned here for backwards compatibility.
1193-
else
1194-
return Undefined(env->isolate());
1190+
// NOTE: For backwards compatibility with public API we return Undefined()
1191+
// if the top level call threw.
1192+
return callback_scope.in_makecallback() ?
1193+
ret : Undefined(env->isolate()).As<Value>();
11951194
}
11961195

11971196
if (has_domain) {

0 commit comments

Comments
 (0)