-
Notifications
You must be signed in to change notification settings - Fork 126
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
Improve error information for serde errors #394
Conversation
?r @torkleyy |
This is the first proof-of-concept. Notably, I've also ported |
Codecov Report
@@ Coverage Diff @@
## master #394 +/- ##
==========================================
- Coverage 89.65% 86.55% -3.10%
==========================================
Files 48 49 +1
Lines 5228 5803 +575
==========================================
+ Hits 4687 5023 +336
- Misses 541 780 +239
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
What I haven't touched yet is the area of adding more contextual information to those new errors. Something we might be able to do is to decorate the We could probably also try to find the name of the current field, though in my opinion, that would be overkill and is already handled by crates like |
I've tried to do the struct/enum/variant name extraction for even better error messages. Just extracting struct/enum names is easy, and we can store them as |
@torkleyy @d86leader What are your thoughts? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! I'm not entirely sure if we should expose provide api guarantees for all of our erroor types. serde_json doesn't expose much in that regard.
I will have to give your comments a closer look later this week, I'm busy right now, sorry. But feel free to proceed without me. |
@torkleyy I've opted to simplify the error enum a bit by merging |
8838cad
to
6668336
Compare
CI is blocked on serde-rs/serde#2255 |
Since we're doing a API-breaking release, I think we should use the opportunity to bump MSRV and get rid of the CI problem at the same time :) |
6668336
to
021eb4c
Compare
@torkleyy This PR is now ready to be merged if you're happy with the changes :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, can't wait to use ron with such nice errors :)
Followup to #393
Adds explicit variants in
ron::Error
forserde
errors fromserde::de::Error
(serde::ser::Error
only has theError::custom
method).CHANGELOG.md