Skip to main content

jira_core/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum JiraError {
5    #[error("HTTP error: {0}")]
6    Http(#[from] reqwest::Error),
7
8    #[error("Authentication error: {0}")]
9    Auth(String),
10
11    #[error("API error (status {status}): {message}")]
12    Api { status: u16, message: String },
13
14    #[error("Configuration error: {0}")]
15    Config(String),
16
17    #[error("Not found: {0}")]
18    NotFound(String),
19
20    #[error("Rate limited — retry after {retry_after}s")]
21    RateLimit { retry_after: u64 },
22
23    #[error("Serialization error: {0}")]
24    Serialization(#[from] serde_json::Error),
25
26    #[error("IO error: {0}")]
27    Io(#[from] std::io::Error),
28}
29
30pub type Result<T> = std::result::Result<T, JiraError>;