Skip to content

Commit e6c64bf

Browse files
Trotttargos
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 <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 2a5f21f commit e6c64bf

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
@@ -1438,9 +1438,7 @@ function formatNamespaceObject(keys, ctx, value, recurseTimes) {
14381438
output[i] = formatProperty(ctx, value, recurseTimes, keys[i],
14391439
kObjectType);
14401440
} catch (err) {
1441-
if (!(isNativeError(err) && err.name === 'ReferenceError')) {
1442-
throw err;
1443-
}
1441+
assert(isNativeError(err) && err.name === 'ReferenceError');
14441442
// Use the existing functionality. This makes sure the indentation and
14451443
// line breaks are always correct. Otherwise it is very difficult to keep
14461444
// this aligned, even though this is a hacky way of dealing with this.

0 commit comments

Comments
 (0)