Skip to content

Commit d33f446

Browse files
Trottruyadorno
authored andcommitted
util: remove unreachable inspect code
Convert invariant from if statement to an assertion. The condition is believed to be impossible to trigger. PR-URL: #37941 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 659fc5d commit d33f446

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

‎lib/internal/util/inspect.js‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,9 +1412,7 @@ function formatNamespaceObject(keys, ctx, value, recurseTimes){
14121412
output[i]=formatProperty(ctx,value,recurseTimes,keys[i],
14131413
kObjectType);
14141414
}catch(err){
1415-
if(!(isNativeError(err)&&err.name==='ReferenceError')){
1416-
throwerr;
1417-
}
1415+
assert(isNativeError(err)&&err.name==='ReferenceError');
14181416
// Use the existing functionality. This makes sure the indentation and
14191417
// line breaks are always correct. Otherwise it is very difficult to keep
14201418
// this aligned, even though this is a hacky way of dealing with this.

0 commit comments

Comments
(0)