grafos_securestore/
error.rs1use crate::epoch::EpochId;
4use alloc::string::String;
5use core::fmt;
6
7#[derive(Debug, PartialEq)]
9pub enum SecureStoreError {
10 NoActiveEpoch,
12 EpochExpired(EpochId),
14 EpochNotFound(EpochId),
16 KeyUnavailable(EpochId),
18 CryptoError(String),
20 StorageError(String),
22}
23
24impl fmt::Display for SecureStoreError {
25 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
26 match self {
27 Self::NoActiveEpoch => write!(f, "no active epoch"),
28 Self::EpochExpired(id) => write!(f, "epoch {} expired", id.0),
29 Self::EpochNotFound(id) => write!(f, "epoch {} not found", id.0),
30 Self::KeyUnavailable(id) => write!(f, "key unavailable for epoch {}", id.0),
31 Self::CryptoError(msg) => write!(f, "crypto error: {}", msg),
32 Self::StorageError(msg) => write!(f, "storage error: {}", msg),
33 }
34 }
35}