rest_api_utils/errors.rs
1pub type CrateResult<T> = Result<T, Error>;
2
3#[derive(Debug, thiserror::Error)]
4pub enum Error {
5 #[error(transparent)]
6 ReqwestError(#[from] reqwest::Error),
7 #[error(transparent)]
8 SerdeJsonError(#[from] serde_json::Error),
9 #[error(transparent)]
10 ApiError(#[from] ApiError),
11 #[error("Unexpected data from server {0}")]
12 UnexpectedData(String)
13}
14
15#[derive(Debug, thiserror::Error)]
16#[error("{0}")]
17pub struct ApiError(pub String);
18
19pub struct NoError();