amq_rpc/
error.rs

1use thiserror::Error;
2
3pub type RpcResult<T> = Result<T, RpcError>;
4
5#[derive(Error, Debug)]
6pub enum RpcError {
7    #[error("Connection error: {0}")]
8    Connection(#[from] lapin::Error),
9
10    #[error("Command timeout")]
11    Timeout,
12
13    #[error("Command cancelled")]
14    Cancelled,
15
16    #[error("Command interrupted")]
17    Interrupted,
18
19    #[error("Serialization error: {0}")]
20    Serialization(#[from] serde_json::Error),
21
22    #[error("Invalid command: {message}")]
23    InvalidCommand { message: String },
24
25    #[error("Server error: {message}")]
26    ServerError { message: String },
27}