Feature Request: set max depth for angular error JSON stringify #15402
Description
I'm submitting a ...
[ ] bug report => search github for a similar issue or PR before submitting
[x] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
Currently, when a (very) deep object is thrown as part of an error. The error message attempts to stringify the object, this freezes browsers for a significant period of time, and then produces an error message, many thousands of lines long. See screenshot
Expected behavior
If there were a default max depth to stringify to, a produced error message would only stringify to this depth from the original object.
Minimal reproduction of the problem with instructions
An object (parent
) references many child objects in a key called children
, each child references its parent object in a key called parent
. Should an error be thrown on a child object (say a Duplicates in a repeater are not allowed
error) the entire structure is stringified in the error section Duplicate value:
.
What is the motivation / use case for changing the behavior?
Speedier error messages, that allow for quicker debugging.
Please tell us about your environment:
OSX 10.12.1, Sublime Text 3, BreezeJS
-
Angular version: 1.5.6
-
Browser: all
-
Language: all (as far as im aware)