Skip to main content

hyperi_rustlib/secrets/
error.rs

1// Project:   hyperi-rustlib
2// File:      src/secrets/error.rs
3// Purpose:   Secrets error types
4// Language:  Rust
5//
6// License:   FSL-1.1-ALv2
7// Copyright: (c) 2026 HYPERI PTY LIMITED
8
9//! Error types for the secrets module.
10
11use thiserror::Error;
12
13/// Secrets module errors.
14#[derive(Debug, Error)]
15pub enum SecretsError {
16    /// Secret not found.
17    #[error("secret not found: {0}")]
18    NotFound(String),
19
20    /// Provider not configured.
21    #[error("provider not configured: {0}")]
22    ProviderNotConfigured(String),
23
24    /// Provider communication error.
25    #[error("provider error: {0}")]
26    ProviderError(String),
27
28    /// Authentication failed.
29    #[error("authentication failed: {0}")]
30    AuthError(String),
31
32    /// I/O error.
33    #[error("I/O error: {0}")]
34    IoError(#[from] std::io::Error),
35
36    /// Cache error.
37    #[error("cache error: {0}")]
38    CacheError(String),
39
40    /// Invalid secret data.
41    #[error("invalid data: {0}")]
42    InvalidData(String),
43
44    /// Refresh failed.
45    #[error("refresh failed: {0}")]
46    RefreshFailed(String),
47
48    /// Configuration error.
49    #[error("configuration error: {0}")]
50    ConfigError(String),
51}
52
53/// Result type for secrets operations.
54pub type SecretsResult<T> = Result<T, SecretsError>;