Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Using error-chain with boxed errors #152

Open
@dgrnbrg

Description

@dgrnbrg

Hello, I have an API which returns a Result<(),Box<std::error::Error + Sync + Send + 'static>>, and I'd like to chain on that. However, I get this error:

error: no method named `chain_err` found for type `std::result::Result<(), std::boxed::Box<std::error::Error + std::marker::Send + std::marker::Sync + 'static>>` in the current scope
   --> src/engine.rs:408:30
    |
408 |                             .chain_err(|| ErrorKind::BoxedIntegrationError)?
    |                              ^^^^^^^^^
    |
    = note: the method `chain_err` exists but the following trait bounds were not satisfied:
            `std::boxed::Box<std::error::Error + std::marker::Send + std::marker::Sync> : std::error::Error`
    = help: items from traits can only be used if the trait is implemented and in scope; the following trait defines an item `chain_err`, perhaps you need to implement it:
    = help: candidate #1: `errors::ResultExt`

Any ideas on how to approach this? The API is 3rd party, so I can't modify it to return a specific error--it must be the boxed trait.

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