| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6133a82 commit 3c62b38
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -935,7 +935,14 @@ function formatRaw(ctx, value, recurseTimes, typedArray) { | |||
| 935 | 935 | protoProps = undefined; | |
| 936 | 936 | } | |
| 937 | 937 | ||
| 938 | - let tag = value[SymbolToStringTag]; | ||
| 938 | + let tag = ''; | ||
| 939 | + | ||
| 940 | + try { | ||
| 941 | + tag = value[SymbolToStringTag]; | ||
| 942 | + } catch { | ||
| 943 | + // Ignore error. | ||
| 944 | + } | ||
| 945 | + | ||
| 939 | 946 | // Only list the tag in case it's non-enumerable / not an own property. | |
| 940 | 947 | // Otherwise we'd print this twice. | |
| 941 | 948 | if (typeof tag !== 'string' || | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1646,7 +1646,7 @@ util.inspect(process); | |||
| 1646 | 1646 | } | |
| 1647 | 1647 | } | |
| 1648 | 1648 | ||
| 1649 | - assert.throws(() => util.inspect(new ThrowingClass()), /toStringTag error/); | ||
| 1649 | + assert.strictEqual(util.inspect(new ThrowingClass()), 'ThrowingClass {}'); | ||
| 1650 | 1650 | ||
| 1651 | 1651 | const y = { | |
| 1652 | 1652 | get [Symbol.toStringTag]() { | |
@@ -1655,7 +1655,11 @@ util.inspect(process); | |||
| 1655 | 1655 | }; | |
| 1656 | 1656 | const x = { y }; | |
| 1657 | 1657 | y.x = x; | |
| 1658 | - assert.throws(() => util.inspect(x), /TypeError: Converting circular structure to JSON/); | ||
| 1658 | + | ||
| 1659 | + assert.strictEqual( | ||
| 1660 | + util.inspect(x), | ||
| 1661 | + '<ref *1> {\n y: { x: [Circular *1], Symbol(Symbol.toStringTag): [Getter] }\n}' | ||
| 1662 | + ); | ||
| 1659 | 1663 | ||
| 1660 | 1664 | class NotStringClass { | |
| 1661 | 1665 | get [Symbol.toStringTag]() { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments