zus_common/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum ZusError {
5  #[error("IO error: {0}")]
6  Io(#[from] std::io::Error),
7
8  #[error("Connection error: {0}")]
9  Connection(String),
10
11  #[error("Protocol error: {0}")]
12  Protocol(String),
13
14  #[error("Timeout error")]
15  Timeout,
16
17  #[error("CRC mismatch")]
18  CrcMismatch,
19
20  #[error("Invalid magic number: {0:#x}")]
21  InvalidMagic(u16),
22
23  #[error("Serialization error: {0}")]
24  Serialization(#[from] prost::DecodeError),
25
26  #[error("Encode error: {0}")]
27  Encode(#[from] prost::EncodeError),
28
29  #[error("RPC error: {0}")]
30  Rpc(String),
31
32  #[error("Service not found: {0}")]
33  ServiceNotFound(String),
34
35  #[error("Method not found: {0}")]
36  MethodNotFound(String),
37
38  #[error("Config error: {0}")]
39  Config(String),
40
41  #[error("Encryption error: {0}")]
42  Encryption(String),
43}
44
45pub type Result<T> = std::result::Result<T, ZusError>;