1
0
Fork 0
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:
Dominic 2021-01-23 16:11:33 +01:00
parent f2bcc8438f
commit cf0223473f
Signed by: msrd0
GPG key ID: DCC8C247452E98F9

View file

@ -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())