use thiserror::Error;
#[derive(Debug, Error)]
pub enum AdapterError {
#[error("HTTP request failed: {0}")]
Http(String),
#[error("Failed to parse response: {0}")]
Parse(String),
#[error("Authentication failed: {0}")]
Auth(String),
#[error("Connection failed: {0}")]
Connection(String),
#[error("Request timed out")]
Timeout,
#[error("Feature not supported: {0}")]
Unsupported(String),
}
#[cfg(feature = "rabbitmq")]
impl From<reqwest::Error> for AdapterError {
fn from(err: reqwest::Error) -> Self {
if err.is_timeout() {
AdapterError::Timeout
} else if err.is_connect() {
AdapterError::Connection(err.to_string())
} else {
AdapterError::Http(err.to_string())
}
}
}