dom_finder 0.6.0

HTML parsing with CSS selectors
Documentation
use thiserror::Error;

/// Errors that can occur on validating the `Config` instance.
#[derive(Error, Debug)]
pub enum ValidationError {
    #[error("the required `{0}` field is missing")]
    FieldIsMissing(String),
    #[error("it is only possible to use either 'extract' or 'children' options")]
    ExtractOrDive,
}

/// Errors that can occur during the pipeline initialization.
#[derive(Error, Debug)]
pub enum PipelineError {
    #[error(transparent)]
    Regex(#[from] regex::Error),
    #[error("pipeline proc with name `{0}` does not exist")]
    ProcDoesNotExist(String),
    #[error("pipeline proc `{0}`: wrong number of arguments, require {1}, got {2}")]
    ProcWrongNumberArguments(String, usize, usize),
}

/// Errors that can be encountered only during creation of the `Finder` instance.
#[derive(Error, Debug)]
pub enum ParseError {
    #[error("matcher can be empty only if `inherit` option is set to true")]
    RequireMatcher,
    #[error(transparent)]
    Validation(#[from] ValidationError),
    #[error(transparent)]
    Pipeline(#[from] PipelineError),
}

#[derive(Error, Debug)]
#[error("got wrong value type, but expecting: {expected}")]
pub struct ValueConversionError {
    pub expected: &'static str,
}