1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use thiserror::Error;

#[derive(Error, Debug)]
pub enum Error {
    #[error("Could not parse the url")]
    InvalidUrl(#[from] url::ParseError),
    #[error("Request failed")]
    RequestFailed(#[from] reqwest::Error),
    #[error("Server answered with non-ok status: {0}")]
    InvalidStatus(reqwest::StatusCode),
    #[error("Could not parse server response: {json}")]
    ParsingFailed {
        #[source]
        error: serde_json::Error,
        json: String,
    },
}