Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Allow skipping the Msg variant #228

Merged

Conversation

sgrif
Copy link
Contributor

@sgrif sgrif commented Sep 30, 2017

While the Msg variant may be a useful option for some users, many will
prefer to stick to more descriptive error types, and won't want this
variant present. This allows a skip_msg_variant flag to be passed to
error_chain!, which will cause no Msg variant to be present in the
generated code.

I've also refactored the body of impl_error_chain_processing to not
care about the number of arguments other than the final branch, so more
cases can be added in the future without having to touch as many places
as I did.

Fixes #200.

@Yamakaky
Copy link
Contributor

Seems nice! Could you update the doc?

@Yamakaky
Copy link
Contributor

Sorry for the delay, could you rebase?

While the `Msg` variant may be a useful option for some users, many will
prefer to stick to more descriptive error types, and won't want this
variant present. This allows a `skip_msg_variant` flag to be passed to
`error_chain!`, which will cause no `Msg` variant to be present in the
generated code.

I've also refactored the body of `impl_error_chain_processing` to not
care about the number of arguments other than the final branch, so more
cases can be added in the future without having to touch as many places
as I did.

Fixes rust-lang-deprecated#200.
@sgrif sgrif force-pushed the sg-allow-skipping-msg-variant branch from 2ed56b8 to b162068 Compare October 13, 2017 00:12
@AndyGauge
Copy link
Contributor

Thanks! I like it.

@AndyGauge AndyGauge merged commit bbadb12 into rust-lang-deprecated:master Jun 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow disabling Msg variant in ErrorKind
3 participants