Skip to main content

minifly_core/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum Error {
5    #[error("Machine not found: {0}")]
6    MachineNotFound(String),
7    
8    #[error("App not found: {0}")]
9    AppNotFound(String),
10    
11    #[error("Invalid configuration: {0}")]
12    InvalidConfiguration(String),
13    
14    #[error("Docker error: {0}")]
15    DockerError(String),
16    
17    #[error("Database error: {0}")]
18    DatabaseError(String),
19    
20    #[error("Network error: {0}")]
21    NetworkError(String),
22    
23    #[error("Authentication failed")]
24    AuthenticationFailed,
25    
26    #[error("Lease conflict")]
27    LeaseConflict,
28    
29    #[error("Invalid lease nonce")]
30    InvalidLeaseNonce,
31    
32    #[error("Resource not found")]
33    NotFound,
34    
35    #[error("Bad request: {0}")]
36    BadRequest(String),
37    
38    #[error("Internal error: {0}")]
39    Internal(String),
40    
41    #[error("LiteFS error: {0}")]
42    LiteFSError(String),
43    
44    #[error(transparent)]
45    Anyhow(#[from] anyhow::Error),
46}
47
48pub type Result<T> = std::result::Result<T, Error>;