pub(super) type AcpResult<T> = Result<T, AcpError>;
#[derive(Debug, thiserror::Error)]
pub(super) enum AcpError {
#[error("Serialization error: {0}")]
SerializationError(String),
#[error("Remote error from {agent_id}: {message}{code}", code = if let Some(code) = code { format!(" (code: {})", code) } else { String::new() })]
RemoteError {
agent_id: String,
message: String,
code: Option<i32>,
},
#[error("Timeout: {0}")]
Timeout(String),
#[error("Internal error: {0}")]
Internal(String),
}
impl From<serde_json::Error> for AcpError {
fn from(err: serde_json::Error) -> Self {
AcpError::SerializationError(err.to_string())
}
}