Skip to main content

fiocz_rs/
error.rs

1//! Error types
2use thiserror::Error;
3
4/// Error types
5#[derive(Error, Debug)]
6pub enum Error {
7    /// Reqwest error
8    #[error(transparent)]
9    Reqwest(#[from] reqwest::Error),
10    /// Serde JSON error
11    #[error(transparent)]
12    SerdeJsonError(#[from] serde_json::Error),
13    /// API limit reached
14    #[error("We have hit the API limit, try again later")]
15    Limit,
16    /// Invalid token
17    #[error("The token does not exist or is deactivated")]
18    Token,
19    /// Malformed request
20    #[error("The request was malformed")]
21    Malformed,
22    /// Too large request
23    #[error("The requesting too many items")]
24    TooLarge,
25    /// Invalid date format
26    #[error("Invalid date format")]
27    InvalidDateFormat,
28    /// Invalid response
29    #[error("Invalid response: {0}")]
30    InvalidResponse(String),
31    /// Missing body
32    #[error("Missing body")]
33    MissingBody,
34    /// Historical data access requires strong authorization (data older than 90 days)
35    #[error("Historical data access requires strong authorization (data older than 90 days)")]
36    HistoricalDataLocked,
37}