use snafu::Snafu;
#[derive(Debug, Snafu)]
#[snafu(visibility(pub(crate)))]
pub enum UnsealError<E: crate::Error> {
#[snafu(display("invalid bundle"))]
InvalidBundle,
#[snafu(display("authentication failed"))]
AuthenticationFailed,
#[snafu(transparent)]
Cipher {
source: E,
},
}
impl<E: crate::Error> crate::Error for UnsealError<E> {
fn is_retryable(&self) -> bool {
match self {
UnsealError::InvalidBundle | UnsealError::AuthenticationFailed => false,
UnsealError::Cipher { source } => source.is_retryable(),
}
}
}