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

Implement From for anyhow errors #171

Open
thewh1teagle opened this issue May 13, 2024 · 0 comments
Open

Implement From for anyhow errors #171

thewh1teagle opened this issue May 13, 2024 · 0 comments

Comments

@thewh1teagle
Copy link

thewh1teagle commented May 13, 2024

I would like to use question mark operator to propagate anyhow::Result inside functions which returns eyre::Result

fn main() -> eyre::Result<()> {
    example()?;
    Ok(())
}

fn example() -> anyhow::Result<()> {
    anyhow::bail!("anyhow error!")
}
error.log
the trait bound `anyhow::Error: std::error::Error` is not satisfied
the following other types implement trait `FromResidual<R>`:
  <Result<T, F> as FromResidual<Yeet<E>>>
  <Result<T, F> as FromResidual<Result<Infallible, E>>>
required for `ErrReport` to implement `From<anyhow::Error>`
required for `Result<(), ErrReport>` to implement `FromResidual<Result<Infallible, anyhow::Error>>`

Related: #178

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

No branches or pull requests

1 participant