1use thiserror::Error;
2
3#[derive(Error, Debug)]
5pub enum Error {
6 #[error("{0}")]
8 Custom(String),
9
10 #[error(transparent)]
12 Io(#[from] std::io::Error),
13
14 #[error(transparent)]
16 Reqwest(#[from] reqwest::Error),
17
18 #[error(transparent)]
20 InvalidHeaderName(#[from] reqwest::header::InvalidHeaderName),
21
22 #[error(transparent)]
24 InvalidHeaderValue(#[from] reqwest::header::InvalidHeaderValue),
25
26 #[error(transparent)]
28 ParseInt(#[from] std::num::ParseIntError),
29
30 #[error(transparent)]
32 Http(#[from] workflow_http::error::Error),
33}
34
35impl From<String> for Error {
36 fn from(s: String) -> Self {
37 Error::Custom(s)
38 }
39}
40
41impl From<&str> for Error {
42 fn from(s: &str) -> Self {
43 Error::Custom(s.to_string())
44 }
45}
46
47impl Error {
48 pub fn custom<T: std::fmt::Display>(msg: T) -> Self {
50 Error::Custom(msg.to_string())
51 }
52}
53
54