Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7c51cec

Browse filesBrowse files
Trottdanielleadams
authored andcommitted
util: use assert for unreachable code
Great effort is taken to keep `util.inspect()` from throwing while inspecting a linked list or other items that require recursion. It is likely still possible at this time to cause a throw with prototype pollution, but that will change soon when the code is modified to use primordials. This commit instructs our coverage to not be concerned about not being able to reach the throwing-an-error code and changes the throw there to an assert so users will be instructed to open a bug with Node.js should they manage to cause the code to throw. PR-URL: #37249 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
1 parent ebf3597 commit 7c51cec
Copy full SHA for 7c51cec

File tree

Expand file treeCollapse file tree

1 file changed

+2
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-1
lines changed
Open diff view settings
Collapse file

‎lib/internal/util/inspect.js‎

Copy file name to clipboardExpand all lines: lib/internal/util/inspect.js
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1360,7 +1360,8 @@ function handleMaxCallStackSize(ctx, err, constructorName, indentationLvl) {
13601360
'special'
13611361
);
13621362
}
1363-
throw err;
1363+
/* c8 ignore next */
1364+
assert.fail(err.stack);
13641365
}
13651366

13661367
function formatNumber(fn, value) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.