Skip to main content

haste_encryption/
error.rs

1use haste_fhir_operation_error::derive::OperationOutcomeError;
2
3#[derive(OperationOutcomeError, Debug)]
4pub enum EncryptionError {
5    #[error(code = "not-found", diagnostic = "Secret '{arg0}' was not found")]
6    SecretNotFound(String),
7
8    #[error(
9        code = "exception",
10        diagnostic = "Failed to retrieve secret '{arg0}': {arg1}"
11    )]
12    SecretRetrievalFailed(String, String),
13
14    #[error(
15        code = "invalid",
16        diagnostic = "Encryption key must be {arg0} bytes, got {arg1}"
17    )]
18    InvalidKeyLength(usize, usize),
19
20    #[error(code = "exception", diagnostic = "Encryption failed: {arg0}")]
21    EncryptionFailed(String),
22
23    #[error(code = "exception", diagnostic = "Decryption failed: {arg0}")]
24    DecryptionFailed(String),
25
26    #[error(
27        code = "not-supported",
28        diagnostic = "Secrets provider '{arg0}' is not yet implemented"
29    )]
30    ProviderNotImplemented(String),
31}