1use thiserror::Error;
4
5#[derive(Debug, Error)]
7pub enum ProcwireError {
8 #[error("I/O error: {0}")]
10 Io(#[from] std::io::Error),
11
12 #[error("JSON error: {0}")]
14 Json(#[from] serde_json::Error),
15
16 #[error("MsgPack encode error: {0}")]
18 MsgPackEncode(#[from] rmp_serde::encode::Error),
19
20 #[error("MsgPack decode error: {0}")]
22 MsgPackDecode(#[from] rmp_serde::decode::Error),
23
24 #[error("Protocol error: {0}")]
26 Protocol(String),
27
28 #[error("Handler not found for method ID: {0}")]
30 HandlerNotFound(u16),
31
32 #[error("Connection closed")]
34 ConnectionClosed,
35
36 #[error("Backpressure timeout")]
38 BackpressureTimeout,
39}
40
41pub type Result<T> = std::result::Result<T, ProcwireError>;