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