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

Use anyhow to add context to errors #143

Open
leplatrem opened this issue Nov 3, 2021 · 0 comments
Open

Use anyhow to add context to errors #143

leplatrem opened this issue Nov 3, 2021 · 0 comments
Labels

Comments

@leplatrem
Copy link
Collaborator

leplatrem commented Nov 3, 2021

Mike recommends us to use anyhow:

For what it's worth, I've had a lot of success combining both thiserror and anyhow. The strings here aren't intended to be machine-readable. Using anyhow lets you preserver more context while keeping the free form nature that strings provide.

Probably not worth changing in this PR, but maybe something to consider for 1.0?

Source #133 (comment)

Example:

        let client = redis::Client::open(settings.redis.url.clone())
            .context("Setting up Redis client")
            .map_err(SetupError::Network)?;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant