Skip to main content

tryaudex_core/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum AvError {
5    #[error("AWS STS error: {0}")]
6    Sts(String),
7
8    #[error("AWS config error: {0}")]
9    AwsConfig(String),
10
11    #[error("GCP error: {0}")]
12    Gcp(String),
13
14    #[error("Azure error: {0}")]
15    Azure(String),
16
17    #[error("Invalid policy: {0}")]
18    InvalidPolicy(String),
19
20    #[error("Session expired: {id}")]
21    SessionExpired { id: String },
22
23    #[error("Session not found: {id}")]
24    SessionNotFound { id: String },
25
26    #[error("Budget exceeded: spent ${spent:.2}, limit ${limit:.2}")]
27    BudgetExceeded { spent: f64, limit: f64 },
28
29    #[error("Process failed with exit code: {0}")]
30    ProcessFailed(i32),
31
32    #[error("Audit log error: {0}")]
33    AuditLog(String),
34
35    #[error("IO error: {0}")]
36    Io(#[from] std::io::Error),
37
38    #[error("JSON error: {0}")]
39    Json(#[from] serde_json::Error),
40}
41
42pub type Result<T> = std::result::Result<T, AvError>;