lib_client_gitlab/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum Error {
5    #[error("Request failed: {0}")]
6    Request(#[from] reqwest::Error),
7
8    #[error("API error ({status}): {message}")]
9    Api { status: u16, message: String },
10
11    #[error("Rate limited, retry after {retry_after}s")]
12    RateLimited { retry_after: u64 },
13
14    #[error("Unauthorized: invalid token")]
15    Unauthorized,
16
17    #[error("Forbidden: {0}")]
18    Forbidden(String),
19
20    #[error("Not found: {0}")]
21    NotFound(String),
22
23    #[error("JSON error: {0}")]
24    Json(#[from] serde_json::Error),
25
26    #[error("Invalid request: {0}")]
27    InvalidRequest(String),
28
29    #[error("Conflict: {0}")]
30    Conflict(String),
31}
32
33pub type Result<T> = std::result::Result<T, Error>;