1use thiserror::Error;
3
4use crate::{api, AuthError};
5
6pub type SpeedrunApiResult<T> = Result<T, SpeedrunApiError>;
8
9#[derive(Debug, Error)]
11#[non_exhaustive]
12pub enum SpeedrunApiError {
13 #[error("API error: {0}")]
15 Api(#[from] api::ApiError<RestError>),
16 #[error("url parse error: {0}")]
18 Parse(#[from] url::ParseError),
19}
20
21#[derive(Debug, Error)]
23#[non_exhaustive]
24pub enum RestError {
25 #[error("communication: {0}")]
27 Communication(#[from] reqwest::Error),
28 #[error("HTTP error: {0}")]
30 Http(#[from] http::Error),
31 #[error("Authentication error: {0}")]
33 Authentication(#[from] AuthError),
34}