axum-utils: make the ErrorWrapper implement std::error::Error

This commit is contained in:
Quentin Gliech
2024-07-24 15:40:26 +02:00
parent 678753c2e1
commit 3276ee713d

View File

@@ -16,13 +16,9 @@ use axum::response::{IntoResponse, Response};
use http::StatusCode;
/// A simple wrapper around an error that implements [`IntoResponse`].
pub struct ErrorWrapper<T>(pub T);
impl<T> From<T> for ErrorWrapper<T> {
fn from(input: T) -> Self {
Self(input)
}
}
#[derive(Debug, thiserror::Error)]
#[error(transparent)]
pub struct ErrorWrapper<T>(#[from] pub T);
impl<T> IntoResponse for ErrorWrapper<T>
where