Skip to main content

trelent_hyok/error/
cache.rs

1//! Error types related to DEK caching operations.
2//!
3//! This module provides error types that may occur during Data Encryption Key (DEK)
4//! caching operations, such as cache misses, storage failures, or invalidation issues.
5
6use core::fmt;
7
8/// Represents an error encountered when accessing or manipulating the DEK cache.
9///
10/// This error type is used when operations on the DEK cache fail, such as:
11/// - Cache insertion failures
12/// - Cache retrieval errors
13/// - Cache invalidation issues
14/// - Storage capacity problems
15#[derive(Debug, Eq, PartialEq)]
16pub struct CacheError(pub String);
17
18impl fmt::Display for CacheError {
19    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
20        write!(f, "A cache error occurred: {}", self.0)
21    }
22}