You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current error format is good for reading in the console, but is not very suitable for sending to error reporting services or otherwise dealing with in a programmatic way, as it's a big string.
Instead, could throw an error subclass with the same fields as the message uses, something like:
Some other things that seem pretty useful for both error reporting and readability:
Have the option to omit the "JSON value" from the error message / hypothetical error properties above. For errors in the leaves of nested json structures, this property can make the error pretty unwieldy.
Consider displaying errors from the top-down instead of the bottom-up, with the leaf error displayed first. This is usually what you're interested in.
If adding the above properties, consider an option to simplify the displayed messages to just the heading of the lowermost error. For instance, if you're fetching an array of blog posts and one of them is bad, error.message would just be: "Fatal error in JsonConvert. Failed to map the JSON object to the class "BlogPost" because the defined JSON property "title" does not exist".
The text was updated successfully, but these errors were encountered:
Hey, thanks for your input. In fact I had already something like this in mind for the next major release. I'll keep this issue open so we'll make sure that it is included in the future.
The current error format is good for reading in the console, but is not very suitable for sending to error reporting services or otherwise dealing with in a programmatic way, as it's a big string.
Instead, could throw an error subclass with the same fields as the message uses, something like:
Some other things that seem pretty useful for both error reporting and readability:
error.message
would just be: "Fatal error in JsonConvert. Failed to map the JSON object to the class "BlogPost" because the defined JSON property "title" does not exist".The text was updated successfully, but these errors were encountered: