-
Notifications
You must be signed in to change notification settings - Fork 184
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
Remove some DataErrorKind
variants
#5041
Conversation
provider/core/src/response.rs
Outdated
@@ -386,7 +386,7 @@ where | |||
DataPayloadInner::Yoke(yoke) => yoke.try_into_yokeable().ok(), | |||
DataPayloadInner::StaticRef(_) => None, | |||
} | |||
.ok_or(DataErrorKind::InvalidState.with_str_context("try_unwrap_owned")) | |||
.ok_or(DataError::custom("DataPayload not owned")) |
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.
Suggestion: Make this function return Option
.
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.
This will duplicate the error in the two call sites in any.rs
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.
This PR gets rid of two errors:
- KeyLocaleSyntax: replaces it with locale parse error. Seems good.
- InvalidState: replaces it with DataError::custom. Not great; we should avoid DataError::custom coming from the core crate.
It would be nice to get rid of InvalidState via some other mechanism, but replacing it with DataError::custom seems like a regression.
Well, it gets rid of the one usage of |
Note that deserialization, in the core crate, also returns custom errors. Downcasting Any is not that different. |
Ok |
No description provided.