1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#[derive(thiserror::Error, Debug)]
pub enum Error {
    #[error("Invalid URL format")]
    UrlParseError,

    #[error("Error whiling requesting API ({0})")]
    RequestError(#[from] ureq::Error),

    #[error("Broken response from server")]
    BadResponseEncoding,

    #[error("Broken response from server: {0}")]
    BadResponseFormat(#[from] serde_json::Error),

    #[error("Failed response from server (Code {0})")]
    FailedResponse(u16),

    #[error("Other errors ({0})")]
    Other(String),
}

pub type Result<T> = std::result::Result<T, Error>;