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
29
30
31
32
33
34
use thiserror::Error;
use crate::{api, AuthError};
pub type SpeedrunApiResult<T> = Result<T, SpeedrunApiError>;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum SpeedrunApiError {
#[error("API error: {0}")]
Api(#[from] api::ApiError<RestError>),
#[error("url parse error: {0}")]
Parse(#[from] url::ParseError),
}
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum RestError {
#[error("communication: {0}")]
Communication(#[from] reqwest::Error),
#[error("HTTP error: {0}")]
Http(#[from] http::Error),
#[error("Authentication error: {0}")]
Authentication(#[from] AuthError),
}