use simdhtml::error::ParseError;
use thiserror::Error;
#[derive(Clone, Debug, Eq, Error, PartialEq)]
pub enum Error {
#[error("parse error: {0}")]
Parse(#[from] ParseError),
#[error(transparent)]
Css(CssError),
#[error(transparent)]
XPath(XPathError),
}
#[derive(Clone, Debug, Eq, Error, PartialEq, Hash)]
pub enum CssError {
#[error("selector error: {message} at byte {position}")]
Selector { message: String, position: usize },
#[error("selector evaluation hit the depth limit")]
DepthLimit,
}
#[derive(Clone, Debug, Eq, Error, PartialEq, Hash)]
pub enum XPathError {
#[error("xpath syntax error at byte {position}: {message}")]
Syntax { position: usize, message: String },
#[error("xpath unsupported: {0}")]
Unsupported(&'static str),
#[error("xpath evaluation error: {0}")]
Eval(String),
#[error("xpath expression exceeded the evaluation budget")]
TooComplex,
}
pub type Result<T, E = Error> = ::core::result::Result<T, E>;