polyte_gamma/
error.rs

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