Skip to content

Doesn't work with thiserror #335

Open
@kvzn

Description

@kvzn

It's the same situation with this issue: dtolnay/thiserror#118

When I use Surf with thiserror like that:

#[error("SurfError")]
SurfError(#[from] surf::Error),

I got issue:

error[E0599]: the method `as_dyn_error` exists for reference `&surf::Error`, but its trait bounds were not satisfied
  --> src/errors.rs:80:13
   |
80 |     #[error("SurfError")]
   |             ^^^^^^^^^^^ method cannot be called on `&surf::Error` due to unsatisfied trait bounds
   |
  ::: /Users/jack/.cargo/registry/src/github.com-1ecc6299db9ec823/http-types-2.12.0/src/error.rs:16:1
   |
16 | pub struct Error {
   | ----------------
   | |
   | doesn't satisfy `surf::Error: AsDynError`
   | doesn't satisfy `surf::Error: StdError`
   |
   = note: the following trait bounds were not satisfied:
           `surf::Error: StdError`
           which is required by `surf::Error: AsDynError`
           `&surf::Error: StdError`
           which is required by `&surf::Error: AsDynError`

Can you solve this? Many thanks!

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