use std::error::Error;
use std::fmt;
#[derive(Debug)]
pub enum SecretManagerError {
UpdateSecretError(Box<dyn Error>),
SecretError(Box<dyn Error>),
}
impl Error for SecretManagerError {
fn source(&self) -> Option<&(dyn Error + 'static)> {
match self {
SecretManagerError::UpdateSecretError(err) => Some(&**err),
SecretManagerError::SecretError(err) => Some(&**err),
}
}
}
impl fmt::Display for SecretManagerError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
SecretManagerError::UpdateSecretError(ref s) => {
write!(f, "failed to update secret: {}", s)
}
SecretManagerError::SecretError(ref s) => write!(f, "failed to fetch secret: {}", s),
}
}
}