1use thiserror::Error;
2
3pub type Result<T> = std::result::Result<T, GaiaError>;
5
6#[derive(Debug, Error)]
8pub enum GaiaError {
9 #[error("failed to connect to Gaia daemon: {0}")]
11 ConnectionError(String),
12
13 #[error("failed to load TLS certificates: {0}")]
15 TlsError(String),
16
17 #[error("failed to read certificate file: {0}")]
19 IoError(#[from] std::io::Error),
20
21 #[error("gRPC transport error: {0}")]
23 TransportError(#[from] tonic::transport::Error),
24
25 #[error("gRPC status error: {0}")]
27 StatusError(Box<tonic::Status>),
28
29 #[error("secret not found: namespace='{0}', id='{1}'")]
31 SecretNotFound(String, String),
32
33 #[error("invalid configuration: {0}")]
35 ConfigError(String),
36
37 #[error("daemon is locked, unlock it first")]
39 DaemonLocked,
40
41 #[error("daemon is offline or unreachable")]
43 DaemonOffline,
44}
45
46impl From<tonic::Status> for GaiaError {
47 fn from(status: tonic::Status) -> Self {
48 GaiaError::StatusError(Box::new(status))
49 }
50}
51