Skip to content
This repository has been archived by the owner on Jan 14, 2025. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant