1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
use thiserror::Error;
pub(crate) type Result<T, E = ClientError> = std::result::Result<T, E>;
#[cfg(any(feature = "ws-async-std", feature = "ws-tokio"))]
pub use async_tungstenite::tungstenite::Error as WsError;
#[derive(Debug, Error)]
pub enum ClientError {
#[error(transparent)]
Json(#[from] serde_json::Error),
#[cfg(feature = "http-async-std")]
#[error(transparent)]
Http(#[from] anyhow::Error),
#[cfg(feature = "http-tokio")]
#[error(transparent)]
Http(#[from] reqwest::Error),
#[cfg(any(feature = "ws-async-std", feature = "ws-tokio"))]
#[error(transparent)]
WebSocket(#[from] WsError),
#[cfg(any(feature = "ws-async-std", feature = "ws-tokio"))]
#[error("WebSocket request timeout")]
WsRequestTimeout,
#[cfg(any(feature = "ws-async-std", feature = "ws-tokio"))]
#[error("Duplicate request ID")]
DuplicateRequestId,
#[cfg(any(feature = "ws-async-std", feature = "ws-tokio"))]
#[error("Invalid request ID")]
InvalidRequestId,
#[cfg(any(feature = "ws-async-std", feature = "ws-tokio"))]
#[error("Invalid subscription ID")]
InvalidSubscriptionId,
#[cfg(any(feature = "ws-async-std", feature = "ws-tokio"))]
#[error("Internal channel error")]
InternalChannel,
}