Skip to content

Switch from failure to anyhow #1851

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

Merged
merged 1 commit into from
Nov 4, 2019
Merged

Conversation

alexcrichton
Copy link
Contributor

This commit switches all of wasm-bindgen from the failure crate to
anyhow. The anyhow crate should serve all the purposes that we
previously used failure for but has a few advantages:

  • It's based on the standard Error trait rather than a custom Fail
    trait, improving ecosystem compatibility.
  • We don't need a #[derive(Fail)], which means that's less code to
    compile for wasm-bindgen. This notably helps the compile time of
    web-sys itself.
  • Using Result<()> in fn main with anyhow::Error produces
    human-readable output, so we can use that natively.

This commit switches all of `wasm-bindgen` from the `failure` crate to
`anyhow`. The `anyhow` crate should serve all the purposes that we
previously used `failure` for but has a few advantages:

* It's based on the standard `Error` trait rather than a custom `Fail`
  trait, improving ecosystem compatibility.
* We don't need a `#[derive(Fail)]`, which means that's less code to
  compile for `wasm-bindgen`. This notably helps the compile time of
  `web-sys` itself.
* Using `Result<()>` in `fn main` with `anyhow::Error` produces
  human-readable output, so we can use that natively.
@alexcrichton alexcrichton merged commit 935f71a into rustwasm:master Nov 4, 2019
@alexcrichton alexcrichton deleted the anyhow branch November 4, 2019 17:35
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