watsonx_rs/
error.rs

1//! Error types for WatsonX-RS
2
3use thiserror::Error;
4
5/// Result type alias for WatsonX operations
6pub type Result<T> = std::result::Result<T, Error>;
7
8/// Errors that can occur when using WatsonX-RS
9#[derive(Clone, Debug, Error)]
10pub enum Error {
11    /// Network-related errors
12    #[error("Network error: {0}")]
13    Network(String),
14
15    /// Authentication errors
16    #[error("Authentication error: {0}")]
17    Authentication(String),
18
19    /// API errors from WatsonX
20    #[error("WatsonX API error: {0}")]
21    Api(String),
22
23    /// Timeout errors
24    #[error("Timeout: {0}")]
25    Timeout(String),
26
27    /// Serialization/deserialization errors
28    #[error("Serialization error: {0}")]
29    Serialization(String),
30
31    /// Configuration errors
32    #[error("Configuration error: {0}")]
33    Configuration(String),
34
35    /// Invalid input errors
36    #[error("Invalid input: {0}")]
37    InvalidInput(String),
38
39    /// Rate limiting errors
40    #[error("Rate limit exceeded: {0}")]
41    RateLimit(String),
42
43    /// Model not found errors
44    #[error("Model not found: {0}")]
45    ModelNotFound(String),
46
47    /// Project not found errors
48    #[error("Project not found: {0}")]
49    ProjectNotFound(String),
50
51    /// I/O errors
52    #[error("I/O error: {0}")]
53    Io(String),
54}