diff --git a/core/src/crypto.rs b/core/src/crypto.rs index c8344f1..de9c921 100644 --- a/core/src/crypto.rs +++ b/core/src/crypto.rs @@ -222,8 +222,7 @@ async fn age_encrypt_with_recipients( return Ok(()); } else { - // TODO: Error handling - unreachable!("No recipients provided"); + return Err(ServiceError::AgeNoRecipientsError); } } diff --git a/core/src/error.rs b/core/src/error.rs index 5949ec9..4be2274 100644 --- a/core/src/error.rs +++ b/core/src/error.rs @@ -40,6 +40,8 @@ pub enum ServiceError { CandidateDetailsNotSet, #[error("Tokio join error")] TokioJoinError(#[from] tokio::task::JoinError), + #[error("Age no recipients error")] + AgeNoRecipientsError, #[error("Age encrypt error")] AgeEncryptError(#[from] age::EncryptError), #[error("Age decrypt error")] @@ -88,6 +90,7 @@ impl ServiceError { ServiceError::CryptoEncryptFailed => 500, ServiceError::CryptoDecryptFailed => 500, ServiceError::CandidateDetailsNotSet => 500, + ServiceError::AgeNoRecipientsError => 500, ServiceError::AgeEncryptError(_) => 500, ServiceError::AgeDecryptError(_) => 500, ServiceError::AgeKeyError(_) => 500,