Skip to main content

kodik_parser/
error.rs

1//! Error types for the Kodik parser library.
2use std::string;
3use thiserror::Error;
4
5/// Errors from kodik-parser.
6#[derive(Error, Debug)]
7#[non_exhaustive]
8pub enum KodikError {
9    /// Reqwest HTTP client error.
10    #[cfg(feature = "async-impl")]
11    #[error("{0}")]
12    Reqwest(#[from] reqwest::Error),
13
14    /// Ureq HTTP client error.
15    #[cfg(feature = "blocking")]
16    #[error("{0}")]
17    Ureq(#[from] ureq::Error),
18
19    /// Base64 decoding error.
20    #[error("{0}")]
21    Decode(#[from] base64::DecodeError),
22
23    /// UTF-8 conversion error.
24    #[error("{0}")]
25    FromUtf8(#[from] string::FromUtf8Error),
26
27    /// Regex matching error.
28    #[error("{0}")]
29    Regex(&'static str),
30
31    /// Link cannot be decoded error.
32    #[error("link cannot be decoded {0}")]
33    LinkCannotBeDecoded(String),
34}