Skip to content

Implement From for anyhow errors #171

Open
@thewh1teagle

Description

@thewh1teagle

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions