sentinel_agent_protocol/
errors.rs

1//! Agent protocol error types.
2
3use std::time::Duration;
4use thiserror::Error;
5
6/// Agent protocol errors
7#[derive(Error, Debug)]
8pub enum AgentProtocolError {
9    #[error("Connection failed: {0}")]
10    ConnectionFailed(String),
11
12    #[error("Protocol version mismatch: expected {expected}, got {actual}")]
13    VersionMismatch { expected: u32, actual: u32 },
14
15    #[error("Message too large: {size} bytes (max: {max}")]
16    MessageTooLarge { size: usize, max: usize },
17
18    #[error("Invalid message format: {0}")]
19    InvalidMessage(String),
20
21    #[error("Timeout after {0:?}")]
22    Timeout(Duration),
23
24    #[error("Agent unavailable")]
25    Unavailable,
26
27    #[error("IO error: {0}")]
28    Io(#[from] std::io::Error),
29
30    #[error("Serialization error: {0}")]
31    Serialization(String),
32}