use crate::span::Span;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Error {
InvalidAttributeName {
at: Span,
name: String,
},
InvalidDoctype {
at: Span,
},
InvalidEntity {
at: Span,
text: String,
},
}
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::InvalidAttributeName { at, name } => {
write!(f, "{at}: invalid attribute name {name:?}")
}
Self::InvalidDoctype { at } => write!(f, "{at}: invalid doctype"),
Self::InvalidEntity { at, text } => {
write!(f, "{at}: invalid entity reference &{text}")
}
}
}
}
impl std::error::Error for Error {}