use std::time::Duration;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum AcpPeerError {
#[error("spawning the ACP peer failed: {0}")]
Spawn(#[source] std::io::Error),
#[error("writing the envelope to the peer failed: {0}")]
Write(#[source] std::io::Error),
#[error("the peer returned a malformed reply: {0}")]
Decode(#[source] serde_json::Error),
#[error("the peer returned an ill-shaped reply: {0}")]
IllShapedReply(String),
#[error("the peer did not reply within {0:?}")]
Timeout(Duration),
#[error("the peer returned a JSON-RPC error: code={code}, message={message}")]
JsonRpc {
code: i64,
message: String,
},
}