question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DecodingFailure contains no useful information

See original GitHub issue

When 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:closed
  • Created 7 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
travisbrowncommented, May 26, 2020

@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 extends Exception is that you can use the Java Throwable hierarchy’s Throwable cause constructor, instead of having to use a custom Exception class or make decisions about how to represent the DecodingFailure as a message string.

0reactions
psttfcommented, May 26, 2020

@travisbrown Thank you for the explanation! It turns out that I was confused by the fact that DecodingFailure extends Exception. This makes it possible to apply IO.fromEither and the like to Decoder.Result, but it results in having untraceable errors without stack traces in error logs. Maybe it is better to not extend Exception at all? Then it will always be necessary to wrap DecodingFailure in an Exception before applying IO.fromEither and automatically get traceable errors? And for convenience there may be a syntax method to do such wrapping easily in a Decoder.Result.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found