You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-08-09 04:22:45 +03:00
axum-utils: make the ErrorWrapper implement std::error::Error
This commit is contained in:
@@ -16,13 +16,9 @@ use axum::response::{IntoResponse, Response};
|
|||||||
use http::StatusCode;
|
use http::StatusCode;
|
||||||
|
|
||||||
/// A simple wrapper around an error that implements [`IntoResponse`].
|
/// A simple wrapper around an error that implements [`IntoResponse`].
|
||||||
pub struct ErrorWrapper<T>(pub T);
|
#[derive(Debug, thiserror::Error)]
|
||||||
|
#[error(transparent)]
|
||||||
impl<T> From<T> for ErrorWrapper<T> {
|
pub struct ErrorWrapper<T>(#[from] pub T);
|
||||||
fn from(input: T) -> Self {
|
|
||||||
Self(input)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T> IntoResponse for ErrorWrapper<T>
|
impl<T> IntoResponse for ErrorWrapper<T>
|
||||||
where
|
where
|
||||||
|
Reference in New Issue
Block a user