Skip to content

Port to anyhow/thiserror #12

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

cgwalters
Copy link

The failure crate isn't being actively developed anymore; having
it as a dependency in the public API is a problem for consumers
that don't use it.

Instead, use anyhow/thiserror; in particular the public API for
errors now implements std::error::Error, which allows consuming
applications to e.g. directly use ? rather than needing a
.map_err(|e| e.compat()).

As the docs for thiserror say:

Thiserror deliberately does not appear in your public API. You get
the same thing as if you had written an implementation of
std::error::Error by hand, and switching from handwritten impls
to thiserror or vice versa is not a breaking change.

And we're only using anyhow internally.

The `failure` crate isn't being actively developed anymore; having
it as a dependency in the public API is a problem for consumers
that don't use it.

Instead, use anyhow/thiserror; in particular the public API for
errors now implements `std::error::Error`, which allows *consuming*
applications to e.g. directly use `?` rather than needing a
`.map_err(|e| e.compat())`.

As the docs for `thiserror` say:

> Thiserror deliberately does not appear in your public API. You get
> the same thing as if you had written an implementation of
> std::error::Error by hand, and switching from handwritten impls
> to thiserror or vice versa is not a breaking change.

And we're only using `anyhow` internally.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant