1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum Error {
5 #[cfg(feature = "__v4")]
6 #[error("WebSocket error: {0:?}")]
7 Tungstenite(#[from] tokio_tungstenite::tungstenite::Error),
8 #[cfg(feature = "__v4")]
9 #[error("Json error: {0:?}")]
10 SerdeJson(#[from] serde_json::Error),
11 #[error("Io error: {0:?}")]
12 Io(#[from] std::io::Error),
13
14 #[cfg(feature = "__v3")]
15 #[error("Leb read error: {0:?}")]
16 LebRead(#[from] leb128::read::Error),
17 #[cfg(feature = "__v3")]
18 #[error("From utf8 error: {0:?}")]
19 FromUtf8(#[from] std::string::FromUtf8Error),
20
21 #[error("Timed out connecting to server")]
22 ConnectTimeout(#[from] tokio::time::error::Elapsed),
23 #[error("Server responded with an invalid type of message")]
25 InvalidMessageType(&'static str),
26}