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 authored and targos committed May 1, 2021
1 parent 2a5f21f commit e6c64bf
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 @@ -1438,9 +1438,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 e6c64bf

Please sign in to comment.