Add axum::Error (#150)

Replace `BoxStdError` and supports downcasting
This commit is contained in:
David Pedersen
2021-08-07 19:56:44 +02:00
committed by GitHub
parent 4792d0c15c
commit 75b5615ccd
12 changed files with 88 additions and 65 deletions
+3 -3
View File
@@ -64,18 +64,18 @@ macro_rules! define_rejection {
#[status = $status:ident]
#[body = $body:expr]
$(#[$m:meta])*
pub struct $name:ident (BoxError);
pub struct $name:ident (Error);
) => {
$(#[$m])*
#[derive(Debug)]
pub struct $name(pub(crate) tower::BoxError);
pub struct $name(pub(crate) crate::Error);
impl $name {
pub(crate) fn from_err<E>(err: E) -> Self
where
E: Into<tower::BoxError>,
{
Self(err.into())
Self(crate::Error::new(err))
}
}