DecodingFailure contains no useful information
See original GitHub issueWhen a DecodingFailure
happens, I expect it to contain some information helpful for debugging, i.e., which part of the json string cannot be decoded. But its message
is just some type name such as String
, Long
, etc and its history
is always an empty List
. Or how can I get more information from a DecodingFailure
?
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
When decoding a message with Circe, is it possible to extract ...
When attempting to decode a json message with circe, I have a requirement to return the original value that caused the decoding failure, ......
Read more >circe/circe - Gitter
Hi, I have encounter an error on decoding a json into an ADT, but the error message is not helping in identifying what...
Read more >DecodingFailure - extends Error
An exception representing a decoding failure and (lazily) capturing the decoding history resulting in the failure. Source: Error.scala. Linear Supertypes.
Read more >Upgrade shredder from 0.19.0 to 2.0.0 decoding failure in ...
Hi, we are currently upgrading out shredder and rdbloader from 0.19.0 to 2.0.0. We have been using this playbook.json { "type": "CUSTOM_JAR", "name":...
Read more >Improved bounds on the decoding failure ... - Lancaster EPrints
they can be significantly useful for wireless networks with ... destination is not available but an effort has been made in [4],.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@psttf This is something we’ve thought a lot about, and while I definitely agree that the current approach isn’t perfect, the trade-offs are something we’ve considered. Not saying it could never change, but I think it’s unlikely.
In general my recommendation would be to try to use alternative approaches to error handling that don’t require you to deal with undifferentiated exceptions in
IO
at some high level, which is when stack traces would be valuable.I know that’s not always practical, though, and if you do decide to wrap the failure in order to get a stack trace, one additional benefit of the fact that
DecodingFailure
extendsException
is that you can use the JavaThrowable
hierarchy’sThrowable cause
constructor, instead of having to use a customException
class or make decisions about how to represent theDecodingFailure
as a message string.@travisbrown Thank you for the explanation! It turns out that I was confused by the fact that
DecodingFailure
extendsException
. This makes it possible to applyIO.fromEither
and the like toDecoder.Result
, but it results in having untraceable errors without stack traces in error logs. Maybe it is better to not extendException
at all? Then it will always be necessary to wrapDecodingFailure
in anException
before applyingIO.fromEither
and automatically get traceable errors? And for convenience there may be a syntax method to do such wrapping easily in aDecoder.Result
.