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),
}