Skip to content
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

Migrate from error_chain? #899

Closed
ehuss opened this issue Apr 22, 2019 · 5 comments
Closed

Migrate from error_chain? #899

ehuss opened this issue Apr 22, 2019 · 5 comments
Labels
C-refactor Category: Code refactoring

Comments

@ehuss
Copy link
Contributor

ehuss commented Apr 22, 2019

error_chain is mostly unmaintained now, I think it would be a good idea to move off it. I only have experience with failure, so that would be my preference as an alternative. But if anyone prefers something else, it would be good to discuss!

@shepmaster
Copy link
Member

anyone prefers something else

I'd like to humbly suggest SNAFU. I think it's the bee's knees.

Is there anything concretely disliked about the current implementation that I could watch out for when preparing a PR for discussion?

@shepmaster
Copy link
Member

Some thoughts on a first skim:

  • There are a lot of stringly-typed errors; basically any use of error_chain:

    utils::fs::remove_dir_content(&build_dir)
        .chain_err(|| "Unable to clear output directory")?;
  • Errors that could provide more information. In the same example, it would be nice to know what directory was unable to be cleared.

  • Multiple errors don't expose any context. For example, I'm pretty sure that this error would be very hard for an end-user to debug, because it's not obvious why we are creating a directory:

    if !parent.exists() {
        fs::create_dir_all(parent)?;
    }

@ehuss ehuss added the C-refactor Category: Code refactoring label May 17, 2019
@shepmaster
Copy link
Member

Does mdBook have a minimum Rust version it targets? I'm seeing a few places that could make use of newer Rust features (like fs::read_to_*).

@shepmaster
Copy link
Member

I've moved a few modules over to SNAFU, if anyone is interested in checking it out or providing early-stage feedback.

@ehuss
Copy link
Contributor Author

ehuss commented May 24, 2021

Closing as error_chain was dropped for anyhow in #1211.

@ehuss ehuss closed this as completed May 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-refactor Category: Code refactoring
Projects
None yet
Development

No branches or pull requests

2 participants