eyre-rs / eyre

A trait object based error handling type for easy idiomatic error handling and reporting in Rust applications
Apache License 2.0
1.35k stars 63 forks source link

Implement From for anyhow errors #171

Open thewh1teagle opened 3 months ago

thewh1teagle commented 3 months ago

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 ```rust the trait bound `anyhow::Error: std::error::Error` is not satisfied the following other types implement trait `FromResidual`: as FromResidual>> as FromResidual>> required for `ErrReport` to implement `From` required for `Result<(), ErrReport>` to implement `FromResidual>` ```

Related: https://github.com/eyre-rs/eyre/pull/178