Skip to main content

tsafe_azure/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum KvError {
5    /// A required environment variable is missing or invalid.
6    #[error("Key Vault configuration error: {0}")]
7    Config(String),
8
9    /// Token acquisition failed (SP or IMDS).
10    #[error("authentication failed: {0}")]
11    Auth(String),
12
13    /// The requested secret does not exist in the vault.
14    #[error("secret not found in Key Vault: {0}")]
15    NotFound(String),
16
17    /// Unexpected HTTP status returned by Key Vault.
18    #[error("Key Vault HTTP {status}: {message}")]
19    Http { status: u16, message: String },
20
21    /// Network or ureq transport error.
22    #[error("transport error: {0}")]
23    Transport(String),
24
25    /// Secret is in a soft-deleted but recoverable state in Azure Key Vault.
26    /// The operator must recover or purge the secret in the Azure portal before retrying.
27    #[error(
28        "secret '{0}' is in a soft-deleted but recoverable state in Azure Key Vault — \
29         recover or purge it in the Azure portal (Portal > Key Vault > Deleted secrets) before retrying"
30    )]
31    SoftDeleted(String),
32}