Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2021-03-27 06:18:06 +0300
committerRuy Adorno <ruyadorno@hotmail.com>2021-03-30 03:17:20 +0300
commitd33f446abded4a71f6ae180b30c954e455b5aed8 (patch)
tree3ed6e21cec23c3453f4505d3fcd572191f3126e9
parent659fc5d6848ce38a942ee8519cc3f532acc968a1 (diff)
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.js4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js
index fed88e963a1..a22f1e7a1b6 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.