Commit 455e6f1
committed
util: throw toJSON errors when formatting %j
Previously all errors resulting from JSON.stringify were treated as a
proof for circularity of the object structure. That is not the case if
the `toJSON` method of the object throws an error. Explicitly check for
the exact error message when determining the object structure's
cyclicity.
PR-URL: #11708
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>1 parent 98e54b0 commit 455e6f1Copy full SHA for 455e6f1
File tree
Expand file treeCollapse file tree
2 files changed
+16
-2
lines changedOpen diff view settings
Filter options
- lib
- test/parallel
Expand file treeCollapse file tree
2 files changed
+16
-2
lines changedOpen diff view settings
Collapse file
+6-2Lines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
38 | 38 | |
39 | 39 | |
40 | 40 | |
| 41 | + |
| 42 | + |
41 | 43 | |
42 | 44 | |
43 | 45 | |
44 | 46 | |
45 | 47 | |
46 | | - |
47 | | - |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
48 | 52 | |
49 | 53 | |
50 | 54 | |
|
Collapse file
test/parallel/test-util-format.js
Copy file name to clipboardExpand all lines: test/parallel/test-util-format.js+10Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
86 | 86 | |
87 | 87 | |
88 | 88 | |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | + |
| 96 | + |
| 97 | + |
| 98 | + |
89 | 99 | |
90 | 100 | |
91 | 101 | |
|
0 commit comments