Commit 455e6f1d authored by Timothy Gu's avatar Timothy Gu
Browse files

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: https://github.com/nodejs/node/pull/11708


Reviewed-By: default avatarLuigi Pinca <luigipinca@gmail.com>
Reviewed-By: default avatarAnna Henningsen <anna@addaleax.net>
Reviewed-By: default avatarSakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: default avatarMichaël Zasso <targos@protonmail.com>
Reviewed-By: default avatarColin Ihrig <cjihrig@gmail.com>
parent 98e54b0b
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment