synap_sdk/
error.rs

1//! Error types for Synap SDK
2
3use thiserror::Error;
4
5/// Result type alias for Synap SDK operations
6pub type Result<T> = std::result::Result<T, SynapError>;
7
8/// Synap SDK error types
9#[derive(Error, Debug)]
10pub enum SynapError {
11    /// HTTP request error
12    #[error("HTTP error: {0}")]
13    HttpError(#[from] reqwest::Error),
14
15    /// JSON serialization/deserialization error
16    #[error("JSON error: {0}")]
17    JsonError(#[from] serde_json::Error),
18
19    /// Invalid URL
20    #[error("Invalid URL: {0}")]
21    InvalidUrl(#[from] url::ParseError),
22
23    /// Server returned an error
24    #[error("Server error: {0}")]
25    ServerError(String),
26
27    /// Key not found
28    #[error("Key not found: {0}")]
29    KeyNotFound(String),
30
31    /// Queue not found
32    #[error("Queue not found: {0}")]
33    QueueNotFound(String),
34
35    /// Stream room not found
36    #[error("Stream room not found: {0}")]
37    RoomNotFound(String),
38
39    /// Invalid response from server
40    #[error("Invalid response: {0}")]
41    InvalidResponse(String),
42
43    /// Operation timeout
44    #[error("Operation timeout")]
45    Timeout,
46
47    /// Generic error
48    #[error("{0}")]
49    Other(String),
50}