#[derive(Debug, thiserror::Error)] pub enum ServiceError { #[error("hyper error")] Hyper(hyper::Error), #[error("unknown host")] NoHost, #[error("can't connect to the backend")] CantConnect, #[error("not found")] NotFound, #[error("io error: {0}")] Io(std::io::Error), #[error("ohh. i didn't expect that this error can be generated.")] Other, } impl From for ServiceError { fn from(e: std::io::Error) -> Self { Self::Io(e) } }