More Context in Exception

2 views
Skip to first unread message

Nathan and Ila Reynolds

unread,
Jan 29, 2015, 12:18:32 AM1/29/15
to jacks...@googlegroups.com
Whenever an exception is thrown by Jackson, please add the string being parsed.  For long strings, only include the 100 characters before and after the position where the parser was at.

Paul Brown

unread,
Jan 29, 2015, 1:37:33 AM1/29/15
to jacks...@googlegroups.com

JsonProcessingException and its subclasses expose a JsonLocation with useful information  about the context of an exception.

Tatu Saloranta

unread,
Jan 29, 2015, 1:49:52 PM1/29/15
to jacks...@googlegroups.com
If that was easy to do, it'd be done. So without someone going through the trouble of changing internals, and, as importantly, without incurring measurable overhead, this probably will not be done with default implementation(s) (there are separate backends for byte[] and char[] based inputs).
Parser does not keep track of content to decode beyond current token, and with streaming amount of content in underlying buffers varies.

But while it is difficult to do this in general, for specific use case you can either implement buffering input source, or other types of buffering. When you know the exact use case and input sources, generally tricky problems become easier to solve for specific usage.

-+ Tatu +-


On Thu, Jan 29, 2015 at 5:18 AM, Nathan and Ila Reynolds <nath...@gmail.com> wrote:
Whenever an exception is thrown by Jackson, please add the string being parsed.  For long strings, only include the 100 characters before and after the position where the parser was at.

--
You received this message because you are subscribed to the Google Groups "jackson-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jackson-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages