polyte_data/
error.rs

1use polyte_core::{ApiError, RequestError};
2use thiserror::Error;
3
4/// Result type for Data API operations
5pub type Result<T> = std::result::Result<T, DataApiError>;
6
7/// Error types for Data API operations
8#[derive(Error, Debug)]
9pub enum DataApiError {
10    /// Core API error
11    #[error(transparent)]
12    Api(#[from] ApiError),
13}
14
15impl RequestError for DataApiError {
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 DataApiError {
22    fn from(err: reqwest::Error) -> Self {
23        Self::Api(ApiError::Network(err))
24    }
25}
26
27impl From<url::ParseError> for DataApiError {
28    fn from(err: url::ParseError) -> Self {
29        Self::Api(ApiError::Url(err))
30    }
31}