1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum ResError {
5 #[error("Internal server error: {0}")]
6 Internal(String),
7
8 #[error("Bad request: {0}")]
9 BadRequest(String),
10
11 #[error("Unauthorized access to realm: {0}")]
12 Unauthorized(String),
13
14 #[error("Forbidden: {0}")]
15 Forbidden(String),
16
17 #[error("Resource not found: {0}")]
18 NotFound(String),
19
20 #[error("Conflict occurred: {0}")]
21 Conflict(String),
22
23 #[error("Unsupported media type: {0}")]
24 UnsupportedMedia(String),
25
26 #[error("Too many requests. Retry after {0} seconds")]
27 TooManyRequests(u64),
28
29 #[error("Service temporarily unavailable. Retry after {0} seconds")]
30 ServiceUnavailable(u64),
31
32 #[error("I/O Error: {0}")]
33 Io(#[from] std::io::Error),
34
35 #[error("Actix Web Error: {0}")]
36 Actix(#[from] actix_web::Error),
37}
38
39pub type Http = Result<actix_web::HttpResponse, ResError>;