workflow_http/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum Error {
5    #[error("Custom: {0}")]
6    Custom(String),
7
8    #[error("Reqwest: {0}")]
9    Reqwest(#[from] reqwest::Error),
10
11    #[error("JSON: {0}")]
12    Json(#[from] serde_json::Error),
13
14    #[error("Not implemented")]
15    NotImplemented,
16}
17
18impl From<String> for Error {
19    fn from(s: String) -> Self {
20        Error::Custom(s)
21    }
22}
23
24impl From<&str> for Error {
25    fn from(s: &str) -> Self {
26        Error::Custom(s.to_string())
27    }
28}
29
30impl Error {
31    pub fn custom<T: ToString>(s: T) -> Self {
32        Error::Custom(s.to_string())
33    }
34}