Skip to main content

brainwires_agent_network/client/
error.rs

1/// Errors from the relay client.
2#[derive(Debug, thiserror::Error)]
3pub enum AgentNetworkClientError {
4    /// Failed to spawn the relay subprocess.
5    #[error("Failed to spawn relay process: {0}")]
6    SpawnFailed(#[source] std::io::Error),
7    /// The relay process exited unexpectedly.
8    #[error("Relay process exited unexpectedly")]
9    ProcessExited,
10    /// Protocol-level error.
11    #[error("Protocol error: {0}")]
12    Protocol(String),
13    /// JSON-RPC error returned by the server.
14    #[error("JSON-RPC error {code}: {message}")]
15    JsonRpc {
16        /// JSON-RPC error code.
17        code: i32,
18        /// Error message.
19        message: String,
20    },
21    /// Request timed out.
22    #[error("Timeout after {0} seconds")]
23    Timeout(u64),
24    /// Client was not initialized before use.
25    #[error("Not initialized - call initialize() first")]
26    NotInitialized,
27    /// I/O error.
28    #[error(transparent)]
29    Io(#[from] std::io::Error),
30    /// JSON serialization/deserialization error.
31    #[error(transparent)]
32    Json(#[from] serde_json::Error),
33}