Skip to main content

aura_store/
errors.rs

1//! Unified storage error handling using macro-generated error types.
2//!
3//! This module uses aura-macros to standardize error categories and messages
4//! without relying on ad-hoc type aliases.
5
6#![allow(missing_docs)] // Macro-generated variants/fields
7
8use aura_macros::aura_error_types;
9
10aura_error_types! {
11    /// Storage error types for persistence operations
12    #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
13    #[allow(missing_docs)]
14    pub enum StorageError {
15        #[category = "storage"]
16        NotFound { key: String } => "Storage key not found: {key}",
17
18        #[category = "storage"]
19        ReadFailed { details: String } => "Storage read failed: {details}",
20
21        #[category = "storage"]
22        WriteFailed { details: String } => "Storage write failed: {details}",
23
24        #[category = "storage"]
25        DeleteFailed { details: String } => "Storage delete failed: {details}",
26
27        #[category = "storage"]
28        ListFailed { details: String } => "Storage list failed: {details}",
29
30        #[category = "storage"]
31        InvalidInput { details: String } => "Storage invalid input: {details}",
32    }
33}
34
35/// Storage result type alias using macro-generated error
36pub type StorageResult<T> = Result<T, StorageError>;