alpaca_websocket/
error.rs

1//! WebSocket-specific error types.
2
3#![allow(missing_docs)]
4
5use alpaca_base::AlpacaError;
6use thiserror::Error;
7
8/// WebSocket-specific errors for the Alpaca client
9#[derive(Error, Debug)]
10pub enum WebSocketError {
11    /// Wrapped base Alpaca error
12    #[error(transparent)]
13    Base(#[from] AlpacaError),
14
15    /// WebSocket connection errors
16    #[error("WebSocket connection error: {0}")]
17    Connection(#[from] tokio_tungstenite::tungstenite::Error),
18
19    /// URL parsing errors
20    #[error("URL parsing error: {0}")]
21    Url(#[from] url::ParseError),
22
23    /// Connection closed unexpectedly
24    #[error("Connection closed: {0}")]
25    ConnectionClosed(String),
26
27    /// Authentication failed
28    #[error("Authentication failed: {0}")]
29    AuthenticationFailed(String),
30
31    /// Subscription error
32    #[error("Subscription error: {0}")]
33    Subscription(String),
34
35    /// Message parsing error
36    #[error("Message parsing error: {0}")]
37    MessageParsing(String),
38
39    /// Channel send error
40    #[error("Channel send error")]
41    ChannelSend,
42
43    /// Reconnection failed
44    #[error("Reconnection failed after {attempts} attempts")]
45    ReconnectionFailed { attempts: u32 },
46}