use std::fmt;
#[derive(Debug)]
pub enum LimitlessError {
ToolNotFound(String),
ConfigError(String),
IoError(String),
ParseError(String),
}
impl fmt::Display for LimitlessError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
LimitlessError::ToolNotFound(tool) => write!(f, "Tool not found: {}", tool),
LimitlessError::ConfigError(msg) => write!(f, "Config error: {}", msg),
LimitlessError::IoError(msg) => write!(f, "IO error: {}", msg),
LimitlessError::ParseError(msg) => write!(f, "Parse error: {}", msg),
}
}
}
impl std::error::Error for LimitlessError {}
impl From<std::io::Error> for LimitlessError {
fn from(e: std::io::Error) -> Self {
LimitlessError::IoError(e.to_string())
}
}