Continuing with error refactoring.
This commit is contained in:
@@ -1,5 +1,33 @@
|
||||
use axum::response::IntoResponse;
|
||||
|
||||
use crate::error::AppError;
|
||||
|
||||
pub mod auth;
|
||||
pub mod form;
|
||||
pub mod json;
|
||||
pub mod path;
|
||||
pub mod query;
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum ExtractorError {
|
||||
#[error(transparent)]
|
||||
Authorization(#[from] auth::AuthError),
|
||||
|
||||
#[error(transparent)]
|
||||
Form(#[from] form::FormError),
|
||||
|
||||
#[error(transparent)]
|
||||
Json(#[from] json::JsonError),
|
||||
|
||||
#[error(transparent)]
|
||||
Path(#[from] path::PathError),
|
||||
|
||||
#[error(transparent)]
|
||||
Query(#[from] query::QueryError),
|
||||
}
|
||||
|
||||
impl IntoResponse for ExtractorError {
|
||||
fn into_response(self) -> axum::response::Response {
|
||||
AppError::from(self).into_response()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user