the trait `std::error::Error` is not implemented for `digest_auth::error::Error` #3
Closed
opened 5 years ago by Ghost
·
6 comments
Loading…
Reference in new issue
There is no content yet.
Delete Branch '%!s(<nil>)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
In 0.1.x versions, we ware able to use
?
operator onrespond()
method if function return type wasResult<_, Box<dyn Error>>
.In version 0.2.0 it looks like
digest_auth::error::Error
is not convertible toBox<dyn Error>
and it started throwing errors.Before, the functions returned
failure::Fallible<_>
, now they return a custom Error, and I removedfailure
as a dependency.Do you think there's something I should add to make it work better?
It would be nice to have it compatible with:
It was super ok for version 0.1.x, now it won't compile with errors as on topic.
Won't that be enough and easy to just implement this trait: https://doc.rust-lang.org/nightly/std/error/trait.Error.html for your custom error? I think you will need to implement just one method -
source()
that will probably just returnNone
;yep, I think that's it, I thought it'll be auto-implemented if you have Display and Debug. I'll add a unit test to check for this compatibility
If something is
Display
andDebug
it won't necessarily beError
;) For exampleIpAddr
. I don't think it could be used as error.of course, it makes sense now.
Please check if version 0.2.1 fixes the problem.
There's some other changes in v0.2, namely
AuthContext
now uses Cows, but the constructor should be backward compatible. It also implements parsing and display for both headers, so it should be usable server-side too.Works like charm