parse_book_source/
error.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use thiserror::Error;

#[derive(Debug, Error)]
pub enum ParseError {
    #[error(transparent)]
    Json(#[from] serde_json::Error),

    #[error(transparent)]
    Reqwest(#[from] reqwest::Error),

    #[error(transparent)]
    Regex(#[from] regex::Error),

    #[error(transparent)]
    JsonPath(#[from] jsonpath_rust::JsonPathParserError),

    #[error(transparent)]
    IO(#[from] std::io::Error),

    #[error(transparent)]
    ParseError(#[from] std::num::ParseIntError),

    #[error(transparent)]
    OtherError(#[from] anyhow::Error),

    #[error("{0}")]
    Warning(String),
}

pub type Result<T> = std::result::Result<T, ParseError>;