Skip to main content

greentic_secrets_runner/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error, Clone, PartialEq, Eq)]
4pub enum SecretError {
5    #[error("secret `{key}` is not allowed by policy")]
6    Denied { key: String },
7    #[error("secret `{key}` not found in environment")]
8    NotFound { key: String },
9}
10
11impl SecretError {
12    pub fn code(&self) -> &'static str {
13        match self {
14            SecretError::Denied { .. } => "denied",
15            SecretError::NotFound { .. } => "not_found",
16        }
17    }
18}