-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Feature Request: set max depth for angular error JSON stringify #15402
Comments
This sounds reasonable, |
Reminder: If we change the |
I think i can do this by one of the following options 1- reimplement JSON.stringify with maxDepth parameter for example convertFromJsonToString
2 -implement clone The JSON with maxDepth then use JSON stringify (use more auxiliary space )
I think the second solution is easy to implement but it it will use more auxiliary spaces . Please give me any suggestion about which solution i should use ? |
I think the second option is preferrable. Re-implementing |
I changed angular.copy to support maxDepth while copping object
so we can clone object with max depth with consideration of backward compatibility if maxDepth is not supplied to the copy method it will copy without a depth. Should this change be done in another pull request like feat(copy): add depth to copy method ? Thanks. |
…in errors configurable Closes angular#15402 Closes angular#15433
I'm submitting a ...
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 calledchildren
, each child references its parent object in a key calledparent
. Should an error be thrown on a child object (say aDuplicates in a repeater are not allowed
error) the entire structure is stringified in the error sectionDuplicate 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)
The text was updated successfully, but these errors were encountered: