use std::error::Error;
use std::fmt;
#[derive(Debug)]
pub enum EncryptionError {
KeyGenError(String),
EncryptError(String),
DecryptError(String),
}
impl fmt::Display for EncryptionError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
EncryptionError::KeyGenError(msg) => write!(f, "Key generation error: {}", msg),
EncryptionError::EncryptError(msg) => write!(f, "Encryption error: {}", msg),
EncryptionError::DecryptError(msg) => write!(f, "Decryption error: {}", msg),
}
}
}
impl Error for EncryptionError {}