1use scraper::error::SelectorErrorKind;
2
3#[derive(Debug)]
5pub enum ScraperError {
6 FetchError(reqwest::Error),
8 ParseError(scraper::error::SelectorErrorKind<'static>),
10 SerializeError(serde_json::Error),
12}
13
14impl From<reqwest::Error> for ScraperError {
15 fn from(error: reqwest::Error) -> Self {
16 ScraperError::FetchError(error)
17 }
18}
19
20impl From<SelectorErrorKind<'static>> for ScraperError {
21 fn from(error: SelectorErrorKind<'static>) -> Self {
22 ScraperError::ParseError(error)
23 }
24}
25
26impl From<serde_json::Error> for ScraperError {
27 fn from(error: serde_json::Error) -> Self {
28 ScraperError::SerializeError(error)
29 }
30}