Skip to main content

glpk_api_sdk/
error.rs

1use thiserror::Error;
2
3/// Result type for GLPK API client operations
4pub type Result<T> = std::result::Result<T, GlpkError>;
5
6/// Errors that can occur when using the GLPK API client
7#[derive(Error, Debug)]
8pub enum GlpkError {
9    /// HTTP request failed
10    #[error("HTTP request failed: {0}")]
11    Request(#[from] reqwest::Error),
12
13    /// Invalid URL provided
14    #[error("Invalid URL: {0}")]
15    InvalidUrl(String),
16
17    /// API returned an error response
18    #[error("API error: {0}")]
19    ApiError(String),
20
21    /// Failed to parse response
22    #[error("Failed to parse response: {0}")]
23    ParseError(String),
24
25    /// Invalid request configuration
26    #[error("Invalid request: {0}")]
27    InvalidRequest(String),
28
29    /// Authentication failed
30    #[error("Authentication failed")]
31    AuthenticationFailed,
32}