-
Notifications
You must be signed in to change notification settings - Fork 17
Error improvements #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This is nice! I like @wclr's version too, but I like that this is a simpler set of changes for much the same result. |
I think the approach with a custom error type is more explicit and concise, though before merging I would like to modify my PR with this approach to point out some details that are not addressed in this one. I also started to port the sum codec to |
@wclr Thanks for the feedback. Could you explain in words, what is not addressed here opposed to your PR? |
@m-bock looked closer.
Obviously not required because one may look at the data itself, but I think tag name context may be useful for quicker error debugging.
I added all the error cases to the tests, which I belive is good thing to have.
Also, in my PR I tried simplify the code of decoding/error logic to make it more unified and dry. I've pushed the changes to my PR based on your approach with the custom error. |
@wclr , I agree with @garyb that one of the main differences between the 'concurring' PR's is that this one here has a smaller diff. It's easier to review, also because it does only one thing. Your PR contains a bit more, surely interesting and useful features. Here's my suggestion: Let's merge this PR and you can create follow up PR's which add improvements step by step in an easy to review way. |
@m-bock No problem. |
👍 to that suggestion. Thanks both! |
This is an alternative solution for PR #68 . It solves issue #66 .
The main idea is: The existing type
Either JsonDecodeError a
for decoders is extended by wrapping it into a custom Error:In this way an unmatched Case is treated as an error. In my view this makes the code a bit simpler, because we profit from short circuiting.
@wclr @garyb
Im curious about your opinions.
Test cases are added, too.