dynosaur
dynosaur copied to clipboard
More verbose error messages in `oneOf`
I like the simplicity of the current error model (just a string is sometimes exactly what you want), but currently if a union fails to decode, you get virtually no information.
Combining the errors somehow would be great to have. Some ideas:
- Either -> EitherNel (probably the most intrusive change)
- ReadError as an ADT
- just combining the strings to a larger string in the decoding logic for alternatives
I actually have some notes on errors in general, the design space is not so trivial. I'm gonna share when I get some time
Agreed, it's definitely not trivial 😅 especially if we consider error accumulation for records too.
also toString for case class ReadError/WriteError is not showing actual message since both these classes are case classes and inherited from Throwable
yeah, just hit this again - @SystemFw do you have bandwidth to give errors a closer look?
For @semenodm's toString issue we can probably to a quick workaround by adding a toString
override.
I'd take a PR to fix the immediate problem with toString
, I don't know how long it'll be before I can look at the design more broadly
I believe the #29 has addressed the issue partially: the resulting error now contains all the underlying branches failures