Skip to main content

hive_client/client/api/
error.rs

1use crate::RefreshError;
2use thiserror::Error;
3
4#[derive(Error, Debug)]
5#[error(transparent)]
6#[non_exhaustive]
7/// Errors that can occur while trying to communicate with the Hive API.
8pub enum ApiError {
9    #[error("An error occurred with the request sent to the Hive API: {0}")]
10    /// The request to the Hive API failed to return a successful response.
11    RequestError(#[from] reqwest::Error),
12
13    #[error("An error occurred while decoding the response from the Hive API: {0}")]
14    /// The response from the Hive API was valid, but could not be decoded.
15    InvalidResponse(#[from] serde_json::Error),
16
17    #[error("An error occurred while trying to refresh the authentication tokens")]
18    /// When refreshing the authentication tokens an error occurred.
19    RefreshError(#[from] RefreshError),
20}