mirror of
https://gitlab.com/msrd0/gotham-restful.git
synced 2025-02-22 20:52:27 +00:00
allow more types to appear in AuthErrorOrOther (related to #20)
This commit is contained in:
parent
f2bcc8438f
commit
cf0223473f
1 changed files with 7 additions and 1 deletions
|
@ -69,10 +69,16 @@ impl<E> From<AuthError> for AuthErrorOrOther<E> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mod private {
|
||||||
|
use gotham::anyhow;
|
||||||
|
pub trait Sealed {}
|
||||||
|
impl<E: Into<anyhow::Error>> Sealed for E {}
|
||||||
|
}
|
||||||
|
|
||||||
impl<E, F> From<F> for AuthErrorOrOther<E>
|
impl<E, F> From<F> for AuthErrorOrOther<E>
|
||||||
where
|
where
|
||||||
// TODO https://gitlab.com/msrd0/gotham-restful/-/issues/20
|
// TODO https://gitlab.com/msrd0/gotham-restful/-/issues/20
|
||||||
F: std::error::Error + Into<E>
|
F: private::Sealed + Into<E>
|
||||||
{
|
{
|
||||||
fn from(err: F) -> Self {
|
fn from(err: F) -> Self {
|
||||||
Self::Other(err.into())
|
Self::Other(err.into())
|
||||||
|
|
Loading…
Add table
Reference in a new issue