-
Notifications
You must be signed in to change notification settings - Fork 145
RUST-1874 Add optional integration with serde_path_to_error
#488
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
#[non_exhaustive] | ||
WithPath { | ||
/// The path to the error. | ||
path: serde_path_to_error::Path, |
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.
I think we need to account for the risk of breaking changes in serde_path_to_error
since we're exposing third-party API here. We could follow the -{version}
name pattern that the other flags use; however, it seems like this crate has been pretty stable over the past five years so it's probably less likely that we'll need to support multiple versions of it. What do you think about just documenting this feature as "unstable" to make sure users know that any breaking changes to serde_path_to_error
will affect their usage of it via this library?
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.
Good call, done.
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! can you also add a note somewhere in the driver docs (maybe the README/lib.rs) pointing users to this feature and showing how to enable it?
RUST-1874
Using the wrapped [de]serialization does come with a small CPU cost and a less small memory cost, so I've made this an optional feature. The user-visible API for this is a new variant for the
ser::Error
andde::Error
types that wraps an inner error along with a path, and corresponding pretty-printed error messages for those. I'd have preferred anError
struct carrier for metadata and anErrorKind
enum here but I think this is a reasonable non-breaking solution.