#[cfg(feature = "http-server")]
use std::io;
#[cfg(feature = "http-server")]
use thiserror::Error;
#[derive(Error, Debug)]
#[cfg(feature = "http-server")]
pub enum HttpServerError {
#[error("HTTP server error: {0}")]
Server(String),
#[error("IO error: {0}")]
Io(#[from] io::Error),
#[error("JSON serialization error: {0}")]
Json(#[from] serde_json::Error),
#[error("Invalid request format: {0}")]
InvalidRequest(String),
}
#[cfg(feature = "http-server")]
impl From<HttpServerError> for crate::domain::A2AError {
fn from(error: HttpServerError) -> Self {
match error {
HttpServerError::Server(msg) => {
crate::domain::A2AError::Internal(format!("HTTP server error: {}", msg))
}
HttpServerError::Io(e) => crate::domain::A2AError::Io(e),
HttpServerError::Json(e) => crate::domain::A2AError::JsonParse(e),
HttpServerError::InvalidRequest(msg) => crate::domain::A2AError::InvalidRequest(msg),
}
}
}