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 <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Trott authored and ruyadorno committed Mar 30, 2021
1 parent 659fc5d commit d33f446
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 d33f446

Please sign in to comment.