Skip to main content

polyoxide_gamma/
error.rs

1use polyoxide_core::{ApiError, RequestError};
2use thiserror::Error;
3
4/// Error types for gamma API operations
5#[derive(Error, Debug)]
6pub enum GammaError {
7    /// Core API error
8    #[error(transparent)]
9    Api(#[from] ApiError),
10}
11
12impl RequestError for GammaError {
13    async fn from_response(response: reqwest::Response) -> Self {
14        Self::Api(ApiError::from_response(response).await)
15    }
16}
17
18impl From<reqwest::Error> for GammaError {
19    fn from(err: reqwest::Error) -> Self {
20        Self::Api(ApiError::Network(err))
21    }
22}
23
24impl From<url::ParseError> for GammaError {
25    fn from(err: url::ParseError) -> Self {
26        Self::Api(ApiError::Url(err))
27    }
28}