1pub type Result<T, E = Error> = std::result::Result<T, E>;
2
3#[derive(thiserror::Error, Debug)]
4pub enum Error {
5 #[error("IO error: {0}")]
6 Io(#[from] std::io::Error),
7
8 #[error("Reqwest error: {0}")]
9 Reqwest(#[from] reqwest::Error),
10
11 #[error("String error: {0}")]
12 String(String),
13}
14
15impl From<&str> for Error {
16 fn from(s: &str) -> Self {
17 Error::String(s.to_string())
18 }
19}
20
21impl From<String> for Error {
22 fn from(s: String) -> Self {
23 Error::String(s)
24 }
25}
26
27impl From<&String> for Error {
28 fn from(s: &String) -> Self {
29 Error::String(s.to_string())
30 }
31}
32
33pub type BoxError = Box<dyn std::error::Error + Send + Sync + 'static>;