use std::fmt;
pub type Result<T> = std::result::Result<T, ParserError>;
#[derive(Debug)]
pub enum ParserError {
Generic(String),
IO(String),
Parse(String),
Component(String),
Css(String),
Html(String),
Directive(String),
NotFound(String),
TsParseError(String),
}
impl fmt::Display for ParserError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Generic(msg) => write!(f, "Generic error: {}", msg),
Self::IO(msg) => write!(f, "I/O error: {}", msg),
Self::Parse(msg) => write!(f, "Parse error: {}", msg),
Self::Component(msg) => write!(f, "Component error: {}", msg),
Self::Css(msg) => write!(f, "CSS error: {}", msg),
Self::Html(msg) => write!(f, "HTML error: {}", msg),
Self::Directive(msg) => write!(f, "Directive error: {}", msg),
Self::NotFound(msg) => write!(f, "Not found: {}", msg),
Self::TsParseError(msg) => write!(f, "TypeScript parse error: {}", msg),
}
}
}
impl std::error::Error for ParserError {}