#[derive(Debug, Fail)] pub(crate) enum ExporterError { #[allow(dead_code)] #[fail(display = "Generic error")] Generic {}, #[fail(display = "Hyper error: {}", e)] Hyper { e: hyper::error::Error }, #[fail(display = "http error: {}", e)] Http { e: http::Error }, #[fail(display = "UTF-8 error: {}", e)] UTF8 { e: std::string::FromUtf8Error }, #[fail(display = "JSON format error: {}", e)] JSON { e: serde_json::error::Error }, #[fail(display = "IO Error: {}", e)] IO { e: std::io::Error }, #[fail(display = "UTF8 conversion error: {}", e)] Utf8 { e: std::str::Utf8Error }, #[fail(display = "int conversion error: {}", e)] ParseInt { e: std::num::ParseIntError }, } impl From for ExporterError { fn from(e: std::io::Error) -> Self { ExporterError::IO { e } } } impl From for ExporterError { fn from(e: hyper::error::Error) -> Self { ExporterError::Hyper { e } } } impl From for ExporterError { fn from(e: http::Error) -> Self { ExporterError::Http { e } } } impl From for ExporterError { fn from(e: std::string::FromUtf8Error) -> Self { ExporterError::UTF8 { e } } } impl From for ExporterError { fn from(e: serde_json::error::Error) -> Self { ExporterError::JSON { e } } } impl From for ExporterError { fn from(e: std::str::Utf8Error) -> Self { ExporterError::Utf8 { e } } } impl From for ExporterError { fn from(e: std::num::ParseIntError) -> Self { ExporterError::ParseInt { e } } }