v8/test/message/fail/json-stringify-circular-ellipsis.out
Simon Zünd eb18edb4f5 [json] Extend JSON#stringify error message for circular structures
This CL extends the kCircularStructure error message to include the
constructors and keys involved in the circle:

const a = {};
a.arr = [];
a.arr[0] = a;
JSON.stringify(a);

TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'Object'
    |     property 'arr' -> object with constructor 'Array'
    --- index 0 closes the circle

R=gsathya@chromium.org, yangguo@chromium.org

Bug: v8:6513, v8:8696
Change-Id: I393aa3ce47d8bfd03734fccac63445006940ef7a
Reviewed-on: https://chromium-review.googlesource.com/c/1433776
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59152}
2019-01-29 08:00:10 +00:00

20 lines
778 B
Plaintext

*%(basename)s:27: TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Object'
| property 'first' -> object with constructor 'Outer'
| property 'x' -> object with constructor 'ArrayHolder'
| ...
| index 1 -> object with constructor 'Inner'
--- property 'y' closes the circle
JSON.stringify(root);
^
TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Object'
| property 'first' -> object with constructor 'Outer'
| property 'x' -> object with constructor 'ArrayHolder'
| ...
| index 1 -> object with constructor 'Inner'
--- property 'y' closes the circle
at JSON.stringify (<anonymous>)
at *%(basename)s:27:6