Skip to main content

rinova_proxy_sdk/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum ProxyError {
5    #[error("{0}")]
6    Message(String),
7
8    #[error(transparent)]
9    Http(#[from] reqwest::Error),
10
11    #[error(transparent)]
12    Yaml(#[from] serde_yaml::Error),
13
14    #[error(transparent)]
15    Json(#[from] serde_json::Error),
16
17    #[error(transparent)]
18    Url(#[from] url::ParseError),
19
20    #[error(transparent)]
21    Io(#[from] std::io::Error),
22}
23
24impl ProxyError {
25    pub fn msg(message: impl Into<String>) -> Self {
26        Self::Message(message.into())
27    }
28}
29
30pub type Result<T> = std::result::Result<T, ProxyError>;