1use uuid::Uuid;
7
8#[derive(Debug, thiserror::Error)]
10pub enum AdminError {
11 #[error("User not found in account: {email}")]
12 UserNotFound { email: String },
13
14 #[error("Invalid filter expression: {message}")]
15 InvalidFilter { message: String },
16
17 #[error("Operation not found: {id}")]
18 OperationNotFound { id: Uuid },
19
20 #[error("Operation cannot be resumed (status: {status})")]
21 CannotResume { status: String },
22
23 #[error("Invalid operation: {message}")]
24 InvalidOperation { message: String },
25
26 #[error("Rate limit exceeded, retry after {retry_after} seconds")]
27 RateLimited { retry_after: u64 },
28
29 #[error("API error: {status} - {message}")]
30 ApiError { status: u16, message: String },
31
32 #[error("State persistence error: {0}")]
33 StateError(#[from] std::io::Error),
34
35 #[error("Serialization error: {0}")]
36 SerializationError(#[from] serde_json::Error),
37
38 #[error(transparent)]
39 Other(#[from] anyhow::Error),
40}
41
42#[derive(Debug, Clone, Copy, PartialEq, Eq)]
44pub enum ExitCode {
45 Success = 0,
47 PartialSuccess = 1,
49 Failure = 2,
51 Cancelled = 3,
53}
54
55impl From<ExitCode> for i32 {
56 fn from(code: ExitCode) -> Self {
57 code as i32
58 }
59}