1use thiserror::Error;
4
5#[derive(Error, Debug)]
6pub enum RspamdError {
7 #[error("HTTP request failed: {0}")]
8 HttpError(String),
9
10 #[error("Serialization/Deserialization error: {0}")]
11 SerdeError(#[from] serde_json::Error),
12
13 #[error("Configuration error: {0}")]
14 ConfigError(String),
15
16 #[error("Unknown error")]
17 Unknown,
18
19 #[error("IO error: {0}")]
20 IOError(#[from] std::io::Error),
21
22 #[error("URL parsing error: {0}")]
23 ParseError(#[from] url::ParseError),
24
25 #[error("Encryption error: {0}")]
26 EncryptionError(String),
27
28 #[error("UTF8 process error: {0}")]
29 UTF8Error(#[from] std::str::Utf8Error),
30
31 #[cfg(feature = "async")]
32 #[error("Invalid HTTP header value: {0}")]
33 InvalidHeaderValue(#[from] reqwest::header::InvalidHeaderValue),
34
35 #[cfg(feature = "async")]
36 #[error("Invalid HTTP header name: {0}")]
37 InvalidHeaderName(#[from] reqwest::header::InvalidHeaderName),
38
39 #[cfg(feature = "async")]
40 #[error("HTTP error: {0}")]
41 HTTPError(#[from] reqwest::Error),
42
43 #[cfg(feature = "sync")]
44 #[error("Invalid HTTP header value: {0}")]
45 InvalidHeaderValue(#[from] attohttpc::header::InvalidHeaderValue),
46
47 #[cfg(feature = "sync")]
48 #[error("Invalid HTTP header name: {0}")]
49 InvalidHeaderName(#[from] attohttpc::header::InvalidHeaderName),
50
51 #[cfg(feature = "sync")]
52 #[error("HTTP error: {0}")]
53 HTTPError(#[from] attohttpc::Error),
54}