use std::num::ParseIntError; #[derive(Debug)] pub struct Error { msg: String, } impl Error { pub fn with_msg>(s: S) -> Self { Self { msg: s.into(), } } } impl From for Error { fn from(k: String) -> Self { Self { msg: k, } } } impl std::fmt::Display for Error { fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result { write!(fmt, "Error") } } impl std::error::Error for Error { } impl From for Error { fn from (k: std::io::Error) -> Self { Self { msg: k.to_string(), } } } impl From for Error { fn from (k: http::Error) -> Self { Self { msg: k.to_string(), } } } impl From for Error { fn from (k: hyper::Error) -> Self { Self { msg: k.to_string(), } } } impl From for Error { fn from (k: serde_json::Error) -> Self { Self { msg: k.to_string(), } } } impl From for Error { fn from (k: async_channel::RecvError) -> Self { Self { msg: k.to_string(), } } } impl From for Error { fn from (k: chrono::format::ParseError) -> Self { Self { msg: k.to_string(), } } } impl From for Error { fn from (k: ParseIntError) -> Self { Self { msg: k.to_string(), } } }