Skip to main content

clasp_client/
error.rs

1//! Client error types
2
3use thiserror::Error;
4
5pub type Result<T> = std::result::Result<T, ClientError>;
6
7#[derive(Error, Debug)]
8pub enum ClientError {
9    #[error("connection failed: {0}")]
10    ConnectionFailed(String),
11
12    #[error("not connected")]
13    NotConnected,
14
15    #[error("already connected")]
16    AlreadyConnected,
17
18    #[error("send failed: {0}")]
19    SendFailed(String),
20
21    #[error("timeout")]
22    Timeout,
23
24    #[error("protocol error: {0}")]
25    Protocol(#[from] clasp_core::Error),
26
27    #[error("transport error: {0}")]
28    Transport(#[from] clasp_transport::TransportError),
29
30    #[error("P2P not connected to peer: {0}")]
31    P2PNotConnected(String),
32
33    #[error("client error: {0}")]
34    Other(String),
35}