Skip to main content

kodik_utils/
error.rs

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