1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#[derive(Debug)]
pub enum ClientError {
    /// Slow down, you've been rate limited
    RateLimit,
    /// API Tier is not high enough for requested data set
    Unauthorized,

    /// QuiverQuant Returned an HTTP 500 Error Code
    InternalServerError,
    
    /// Error occured during HTTP Request
    HttpError(reqwest::Error),

    /// API Key is not a valid HTTP Header
    ApiKeyInvalid(reqwest::header::InvalidHeaderValue)
}

impl From<reqwest::Error> for ClientError {
    fn from(error: reqwest::Error) -> Self {
        ClientError::HttpError(error)
    }
}

impl From<reqwest::header::InvalidHeaderValue> for ClientError {
    fn from(error: reqwest::header::InvalidHeaderValue) -> Self {
        ClientError::ApiKeyInvalid(error)
    }
}