anime_grubber/
error.rs

1use reqwest::StatusCode;
2use thiserror::Error;
3/// Represents the errors that can occur in the application.
4///
5/// This enum defines various error types that may arise during the execution
6/// of the application. It implements the `thiserror::Error` trait, allowing
7/// for convenient error handling and formatting.
8///
9/// # Variants
10/// - `NotFound`: An error indicating that a requested resource was not found.
11/// - `Reqwest`: An error originating from the `reqwest` crate, typically related
12///   to HTTP requests.
13/// - `MiniSerde`: An error that occurs during deserialization using the
14///   `miniserde` library.
15#[derive(Error, Debug)]
16pub enum Error {
17    #[error("Not found")]
18    NotFound,
19    #[error("Too many requsts")]
20    RateLimit,
21    #[error("Request failed with status: {0}")]
22    RequestFailed(StatusCode),
23    #[error("Some reqwest trouble")]
24    Reqwest(#[from] reqwest::Error),
25    #[error("Desirialise error")]
26    MiniSerde(#[from] miniserde::Error),
27}