diff options
Diffstat (limited to 'src/error/mod.rs')
| -rw-r--r-- | src/error/mod.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/error/mod.rs b/src/error/mod.rs index 4b8e1c4..07db26f 100644 --- a/src/error/mod.rs +++ b/src/error/mod.rs | |||
| @@ -5,7 +5,7 @@ pub use client::ClientError; | |||
| 5 | pub use server::ServerError; | 5 | pub use server::ServerError; |
| 6 | 6 | ||
| 7 | use argon2::password_hash::Error as PasswordHashError; | 7 | use argon2::password_hash::Error as PasswordHashError; |
| 8 | use axum::extract::rejection::JsonRejection; | 8 | use axum::extract::rejection::{JsonRejection, QueryRejection}; |
| 9 | use axum_extra::typed_header::TypedHeaderRejection; | 9 | use axum_extra::typed_header::TypedHeaderRejection; |
| 10 | use sea_orm::DbErr; | 10 | use sea_orm::DbErr; |
| 11 | 11 | ||
| @@ -34,6 +34,12 @@ impl From<JsonRejection> for ApiError { | |||
| 34 | } | 34 | } |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | impl From<QueryRejection> for ApiError { | ||
| 38 | fn from(value: QueryRejection) -> Self { | ||
| 39 | ClientError::BadJsonBody(value.body_text()).into() | ||
| 40 | } | ||
| 41 | } | ||
| 42 | |||
| 37 | impl From<TypedHeaderRejection> for ApiError { | 43 | impl From<TypedHeaderRejection> for ApiError { |
| 38 | fn from(value: TypedHeaderRejection) -> Self { | 44 | fn from(value: TypedHeaderRejection) -> Self { |
| 39 | ClientError::BadAuthTokenHeader(value.to_string()).into() | 45 | ClientError::BadAuthTokenHeader(value.to_string()).into() |
