blob: 074a8ef36c86e1f7fb95ef6d48c4300c0eae59d6 (
plain) (
tree)
|
|
use std::error::Error;
use std::fmt;
#[derive(Debug)]
pub enum SMPError {
IncludeError(u8, std::io::Error, String),
ShellCommandError(u8, Box<dyn Error>),
}
impl fmt::Display for SMPError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
SMPError::IncludeError(code, _, file) => {
write!(f, "[SMP{}] Error reading file \"{}\"", code, file)
}
SMPError::ShellCommandError(code, e) => {
write!(f, "[SMP{}] Error running shell command \"{:#?}\"", code, e)
}
}
}
}
impl std::error::Error for SMPError {}
|