deribit_websocket/error/
mod.rs

1//! Error handling module for WebSocket client
2
3/// WebSocket-specific errors
4#[derive(Debug, thiserror::Error)]
5pub enum WebSocketError {
6    #[error("Connection failed: {0}")]
7    /// Connection failed with error message
8    ConnectionFailed(String),
9
10    #[error("Authentication failed: {0}")]
11    /// Authentication failed with error message
12    AuthenticationFailed(String),
13
14    #[error("Subscription failed: {0}")]
15    /// Subscription failed with error message
16    SubscriptionFailed(String),
17
18    #[error("Invalid message format: {0}")]
19    /// Invalid message format
20    InvalidMessage(String),
21
22    #[error("Connection closed unexpectedly")]
23    /// Connection was closed
24    ConnectionClosed,
25
26    #[error("Heartbeat timeout")]
27    /// Heartbeat timeout occurred
28    HeartbeatTimeout,
29
30    #[error("API error {0}: {1}")]
31    /// API error with code and message
32    ApiError(i32, String),
33}