-
-
Notifications
You must be signed in to change notification settings - Fork 163
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
Support using error message from source #12
Comments
I would accept a PR to treat: #[derive(Error, Debug)]
#[error(...)]
pub enum SomeParseFromEnvError {
InvalidLogFormat(ParseFromEnvError<InvalidLogFormat>),
InvalidBool(ParseFromEnvError<ParseBoolError>),
InvalidInfallible(ParseFromEnvError<Infallible>),
} as equivalent to: #[derive(Error, Debug)]
pub enum SomeParseFromEnvError {
#[error(...)]
InvalidLogFormat(ParseFromEnvError<InvalidLogFormat>),
#[error(...)]
InvalidBool(ParseFromEnvError<ParseBoolError>),
#[error(...)]
InvalidInfallible(ParseFromEnvError<Infallible>),
} Would that work for your use case? You would put
Thanks, I filed #13 to track this separately. |
I guess Having to write it for every line may bothers me less than the this thing: |
You can alternatively write I think I wouldn't consider this annoying enough to introduce a new |
Closing in favor of #18. |
I have a very simple enum that just wraps all other error types:
The
Display
implementation I have doesn't do anything fancy - it just relies thefmt
directly to the wrapped value:I need a simple way to derive the same behavior.
Annotation every field with
#[error("{0})]
is an option that I currently have to use, but it doesn't expand to the same code I write manually.Also,
#[error("{0})]
above every field doesn't look good 😄The text was updated successfully, but these errors were encountered: