gemini_live_api/
error.rs

1use thiserror::Error;
2use tokio_tungstenite::tungstenite;
3
4#[derive(Error, Debug)]
5pub enum GeminiError {
6    #[error("WebSocket connection error: {0}")]
7    WebSocketError(#[from] tungstenite::Error),
8
9    #[error("JSON serialization/deserialization error: {0}")]
10    SerdeError(#[from] serde_json::Error),
11
12    #[error("I/O error: {0}")]
13    IoError(#[from] std::io::Error),
14
15    #[error("API error: {0}")]
16    ApiError(String),
17
18    #[error("Connection not established or setup not complete")]
19    NotReady,
20
21    #[error("Message from server was not in expected format")]
22    UnexpectedMessage,
23
24    #[error("Attempted to send message on a closed connection")]
25    ConnectionClosed,
26
27    #[error("Function call handler not found for: {0}")]
28    FunctionHandlerNotFound(String),
29
30    #[error("Error sending message")]
31    SendError,
32
33    #[error("Missing API key")]
34    MissingApiKey,
35}