Skip to content

Commit

Permalink
util: remove unreachable inspect code
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Trott committed Mar 29, 2021
1 parent f7b82de commit 45cdc13
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/internal/util/inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -1412,9 +1412,7 @@ function formatNamespaceObject(keys, ctx, value, recurseTimes) {
output[i] = formatProperty(ctx, value, recurseTimes, keys[i],
kObjectType);
} catch (err) {
if (!(isNativeError(err) && err.name === 'ReferenceError')) {
throw err;
}
assert(isNativeError(err) && err.name === 'ReferenceError');
// Use the existing functionality. This makes sure the indentation and
// line breaks are always correct. Otherwise it is very difficult to keep
// this aligned, even though this is a hacky way of dealing with this.
Expand Down

0 comments on commit 45cdc13

Please sign in to comment.