diff options
author | Rich Trott <rtrott@gmail.com> | 2021-03-26 20:18:06 -0700 |
---|---|---|
committer | Ruy Adorno <ruyadorno@hotmail.com> | 2021-03-29 20:17:20 -0400 |
commit | d33f446abded4a71f6ae180b30c954e455b5aed8 (patch) | |
tree | 3ed6e21cec23c3453f4505d3fcd572191f3126e9 | |
parent | 659fc5d6848ce38a942ee8519cc3f532acc968a1 (diff) | |
download | node-new-d33f446abded4a71f6ae180b30c954e455b5aed8.tar.gz |
util: remove unreachable inspect code
Convert invariant from if statement to an assertion. The condition is
believed to be impossible to trigger.
PR-URL: https://github.com/nodejs/node/pull/37941
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
-rw-r--r-- | lib/internal/util/inspect.js | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index fed88e963a..a22f1e7a1b 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -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. |