Skip to content

Commit c3d87ee

Browse files
trevnorrisMyles Borins
authored and
Myles Borins
committed
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. Ref: #7048 PR-URL: #5756 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Andreas Madsen <[email protected]>
1 parent ee70405 commit c3d87ee

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/node.cc

+4-5
Original file line numberDiff line numberDiff line change
@@ -1177,11 +1177,10 @@ Local<Value> MakeCallback(Environment* env,
11771177
}
11781178

11791179
if (ret.IsEmpty()) {
1180-
if (callback_scope.in_makecallback())
1181-
return ret;
1182-
// NOTE: Undefined() is returned here for backwards compatibility.
1183-
else
1184-
return Undefined(env->isolate());
1180+
// NOTE: For backwards compatibility with public API we return Undefined()
1181+
// if the top level call threw.
1182+
return callback_scope.in_makecallback() ?
1183+
ret : Undefined(env->isolate()).As<Value>();
11851184
}
11861185

11871186
if (has_domain) {

0 commit comments

Comments
 (0)