1mod datasource;
2mod libs;
3
4use strum_macros::{Display, EnumString};
5
6#[derive(Debug, thiserror::Error)]
7pub enum CrabError {
8 #[error("Could not find resource")]
9 NotFound,
10 #[error("Could not get info from datasource")]
11 DatasourceError(String),
12 #[error("ServerError")]
13 ServerError(String),
14 #[error("No Extensions")]
15 ErrorWithoutExtensions,
16 #[error("ValidationError: {reason:?} {code:?}")]
17 ValidationError { reason: String, code: String },
18 #[error("File size exceeds the maximum limit {0}")]
19 MaxFileSizeError(String),
20 #[error("Content Type not allowed {0}")]
21 ContentTypeError(String),
22 #[error(transparent)]
23 Anyhow(#[from] anyhow::Error),
24 #[error("Unauthorized")]
25 Unauthorized,
26 #[error("Forbidden")]
27 Forbidden,
28}
29
30#[derive(Debug, Display)]
31#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
32pub enum CrabErrorRetry {
33 None,
34 Retry,
35 WaitAndRetry,
36 Cancel,
37}
38