1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
pub type CrateResult<T> = Result<T, Error>;

#[derive(Debug, thiserror::Error)]
pub enum Error {
    #[error(transparent)]
    ReqwestError(#[from] reqwest::Error),
    #[error(transparent)]
    SerdeJsonError(#[from] serde_json::Error),
    #[error(transparent)]
    ApiError(#[from] ApiError),
    #[error("Unexpected data from server {0}")]
    UnexpectedData(String)
}

#[derive(Debug, thiserror::Error)]
#[error("{0}")]
pub struct ApiError(pub String);

pub struct NoError();