Skip to main content

html_cleaning/
error.rs

1//! Error types for html-cleaning.
2
3use thiserror::Error;
4
5/// Error type for html-cleaning operations.
6#[derive(Debug, Error)]
7pub enum Error {
8    /// Invalid CSS selector syntax.
9    #[error("invalid selector: {0}")]
10    InvalidSelector(String),
11
12    /// HTML parsing error.
13    #[error("parse error: {0}")]
14    ParseError(String),
15
16    /// URL parsing error (with url feature).
17    #[cfg(feature = "url")]
18    #[error("url error: {0}")]
19    UrlError(#[from] url::ParseError),
20}
21
22/// Result type alias for html-cleaning.
23pub type Result<T> = std::result::Result<T, Error>;