use std::convert::From; use std::io::Error as IOError; use std::error::Error as STDError; use logger::LogLevel; pub struct Error { description: String, severity: LogLevel, } impl Error { pub fn new>(severity: LogLevel, description: T) -> Error { Error { severity, description: description.into(), } } pub fn description(&self) -> String { self.description.clone() } pub fn severity(&self) -> LogLevel { self.severity.clone() } } impl From for Error { fn from(err: IOError) -> Error { Error { description: err.description().to_owned(), severity: LogLevel::SEVERE, } } }