Impl Display for TealdeerError

This commit is contained in:
Danilo Bargen 2018-10-22 18:03:07 +02:00
commit 6fcb1e17de

View file

@ -1,3 +1,4 @@
use std::fmt;
use curl::Error as CurlError;
#[derive(Debug)]
@ -12,3 +13,13 @@ impl From<CurlError> for TealdeerError {
TealdeerError::UpdateError(format!("Curl error: {}", err.to_string()))
}
}
impl fmt::Display for TealdeerError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
TealdeerError::CacheError(e) => write!(f, "CacheError: {}", e),
TealdeerError::ConfigError(e) => write!(f, "ConfigError: {}", e),
TealdeerError::UpdateError(e) => write!(f, "UpdateError: {}", e),
}
}
}