qudag_crypto/encryption/
mod.rs1use std::error::Error;
2use std::fmt;
3
4#[derive(Debug)]
6pub enum EncryptionError {
7 KeyGenError(String),
9 EncryptError(String),
11 DecryptError(String),
13}
14
15impl fmt::Display for EncryptionError {
16 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
17 match self {
18 EncryptionError::KeyGenError(msg) => write!(f, "Key generation error: {}", msg),
19 EncryptionError::EncryptError(msg) => write!(f, "Encryption error: {}", msg),
20 EncryptionError::DecryptError(msg) => write!(f, "Decryption error: {}", msg),
21 }
22 }
23}
24
25impl Error for EncryptionError {}
26
27