1use tower::BoxError;
18
19pub type Result<T> = std::result::Result<T, Error>;
21
22#[derive(Debug, thiserror::Error)]
24pub enum Error {
25 #[error("Serialization failed: {0}")]
26 Serialization(#[from] serde_json::Error),
27
28 #[error("get result failed: {0}")]
29 ErrResult(String),
30
31 #[error("param:{0} with error_message:{1}")]
32 InvalidParam(String, String),
33
34 #[error("request_id:{0:?} ret_code:{1} error_code:{2} message:{3:?}")]
35 ErrResponse(Option<String>, i32, i32, Option<String>),
36
37 #[cfg(feature = "config")]
39 #[error("config not found: {0}")]
40 ConfigNotFound(String),
41
42 #[cfg(feature = "config")]
44 #[error("config query conflict: {0}")]
45 ConfigQueryConflict(String),
46
47 #[error("remote client shutdown failed: {0}")]
48 ClientShutdown(String),
49
50 #[error("remote client unhealthy failed: {0}")]
51 ClientUnhealthy(String),
52
53 #[error("tonic grpc transport error: {0}")]
54 TonicGrpcTransport(#[from] tonic::transport::Error),
55
56 #[error("tonic grpc status error: {0}")]
57 TonicGrpcStatus(#[from] tonic::Status),
58
59 #[error("grpc request error: {0}")]
60 GrpcBufferRequest(#[from] BoxError),
61
62 #[error("no available server")]
63 NoAvailableServer,
64
65 #[error("Wrong server address: {0}")]
66 WrongServerAddress(String),
67
68 #[error("Exceeded maximum retry attempts: {0}")]
69 MaxRetriesExceeded(u32),
70}