1use thiserror::Error;
2
3#[derive(Error, Debug)]
5pub enum Error {
6 #[error("JSON parsing error: {0}")]
8 Json(#[from] serde_json::Error),
9
10 #[error("IO error: {0}")]
12 Io(#[from] std::io::Error),
13
14 #[error("Protocol framing error: invalid JSON in message")]
16 FramingError,
17
18 #[error(
20 "File descriptor count mismatch: fds field specifies {expected}, but {found} FDs available"
21 )]
22 MismatchedCount {
23 expected: usize,
25 found: usize,
27 },
28
29 #[error("System call error: {0}")]
31 SystemCall(String),
32
33 #[error("Connection closed")]
35 ConnectionClosed,
36
37 #[error("Invalid message format: {0}")]
39 InvalidMessage(String),
40}
41
42pub type Result<T> = std::result::Result<T, Error>;