soph_server/error/
mod.rs

1use crate::traits::ErrorTrait;
2
3#[derive(thiserror::Error, Debug)]
4pub enum Error {
5    #[error(transparent)]
6    Any(#[from] soph_core::AnyError),
7
8    #[error(transparent)]
9    Container(#[from] soph_core::error::ContainerError),
10
11    #[error(transparent)]
12    FormRejection(#[from] axum::extract::rejection::FormRejection),
13
14    #[error(transparent)]
15    HttpError(#[from] axum::http::Error),
16
17    #[error(transparent)]
18    InvalidHeaderName(#[from] axum::http::header::InvalidHeaderName),
19
20    #[error(transparent)]
21    InvalidMethod(#[from] axum::http::method::InvalidMethod),
22
23    #[error(transparent)]
24    InvalidHeaderValue(#[from] axum::http::header::InvalidHeaderValue),
25
26    #[error(transparent)]
27    IO(#[from] std::io::Error),
28
29    #[cfg(feature = "request-auth")]
30    #[error(transparent)]
31    Auth(#[from] soph_auth::error::Error),
32
33    #[cfg(feature = "request-json")]
34    #[error(transparent)]
35    JsonRejection(#[from] axum::extract::rejection::JsonRejection),
36
37    #[cfg(feature = "request-multipart")]
38    #[error(transparent)]
39    MultipartRejection(#[from] axum::extract::multipart::MultipartRejection),
40
41    #[cfg(feature = "request-multipart")]
42    #[error(transparent)]
43    Multipart(#[from] axum::extract::multipart::MultipartError),
44
45    #[cfg(feature = "request-path")]
46    #[error(transparent)]
47    PathRejection(#[from] axum::extract::rejection::PathRejection),
48
49    #[cfg(feature = "request-query")]
50    #[error(transparent)]
51    QueryRejection(#[from] axum::extract::rejection::QueryRejection),
52
53    #[cfg(feature = "database")]
54    #[error(transparent)]
55    SeaOrm(#[from] sea_orm::DbErr),
56
57    #[error(transparent)]
58    SerdeJson(#[from] serde_json::Error),
59
60    #[cfg(feature = "response-view")]
61    #[error(transparent)]
62    Tera(#[from] tera::Error),
63
64    #[error(transparent)]
65    ToStr(#[from] axum::http::header::ToStrError),
66
67    #[error("Unsupported media type")]
68    UnsupportedMediaType,
69
70    #[cfg(feature = "request-id")]
71    #[error(transparent)]
72    Uuid(#[from] uuid::Error),
73
74    #[cfg(feature = "request-validate")]
75    #[error(transparent)]
76    Validate(#[from] validator::ValidationErrors),
77}
78
79impl ErrorTrait for Error {}