armature_websocket/
error.rs1use thiserror::Error;
4
5#[derive(Error, Debug)]
7pub enum WebSocketError {
8 #[error("Connection error: {0}")]
10 Connection(String),
11
12 #[error("Protocol error: {0}")]
14 Protocol(#[from] tungstenite::Error),
15
16 #[error("IO error: {0}")]
18 Io(#[from] std::io::Error),
19
20 #[error("Serialization error: {0}")]
22 Serialization(#[from] serde_json::Error),
23
24 #[error("Connection not found: {0}")]
26 ConnectionNotFound(String),
27
28 #[error("Room not found: {0}")]
30 RoomNotFound(String),
31
32 #[error("Connection closed")]
34 ConnectionClosed,
35
36 #[error("Failed to send message: {0}")]
38 Send(String),
39
40 #[error("Operation timed out")]
42 Timeout,
43
44 #[error("TLS error: {0}")]
46 Tls(String),
47
48 #[error("Invalid URL: {0}")]
50 InvalidUrl(String),
51
52 #[error("Server error: {0}")]
54 Server(String),
55}
56
57pub type WebSocketResult<T> = Result<T, WebSocketError>;
59