karo_common_rpc/error.rs
1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Serialize, Deserialize, Clone)]
4pub enum Error {
5 /// User is not allowed to register with a provided service name, or
6 /// not allowed to connect to a requested client
7 NotAllowed,
8 /// Not such endpoint to call or subscribe to
9 NoEndpoint,
10 /// Service or endpoind had been registered already
11 AlreadyRegistered,
12 /// Not found a requested service
13 ServiceNotFound,
14 /// Peer disconnected
15 PeerDisconnected,
16 /// Internal protocol error. Ideally should never occur
17 ProtocolError,
18 /// Invalid params to a call. Contains deserialization error
19 ParamsTypeError(String),
20 /// Invalid result type of an enpoint requested. Either call result type, or
21 /// subscription result type. COntains deserialization error
22 ResultTypeError(String),
23 /// Internal library error. Should never happen
24 InternalError(String),
25 /// Client endpoint error
26 EndpointError(String),
27}
28
29pub type Result<T> = std::result::Result<T, Error>;