use thiserror::Error;
use crate::{
applications::error::ApplicationsError, images::error::ImagesError,
secrets::error::SecretsError,
};
#[derive(Debug, Error)]
pub enum SdkError {
#[error(transparent)]
Applications(#[from] ApplicationsError),
#[error("Authentication failed: {0}")]
Authentication(String),
#[error("Authorization failed: {0}")]
Authorization(String),
#[error(transparent)]
Http(#[from] reqwest::Error),
#[error(transparent)]
Middleware(#[from] reqwest_middleware::Error),
#[error(transparent)]
Images(#[from] ImagesError),
#[error("Invalid header value: {0}")]
InvalidHeaderValue(String),
#[error("Client error: {0}")]
ClientError(String),
#[error(transparent)]
Io(#[from] std::io::Error),
#[error(transparent)]
Json(#[from] serde_json::Error),
#[error(transparent)]
JsonWithError(#[from] serde_path_to_error::Error<serde_json::Error>),
#[error(transparent)]
Secrets(#[from] SecretsError),
#[error("Server error: {status} - {message}")]
ServerError {
status: reqwest::StatusCode,
message: String,
},
#[error("EventSource error: {0}")]
EventSourceError(String),
}