feat: age no recipients error

This commit is contained in:
Sebastian Pravda 2022-12-14 13:22:13 +01:00
parent fb07608114
commit d797477393
No known key found for this signature in database
GPG key ID: F3BC84F08EFA3F57
2 changed files with 4 additions and 2 deletions

View file

@ -222,8 +222,7 @@ async fn age_encrypt_with_recipients<W: tokio::io::AsyncWrite + Unpin>(
return Ok(()); return Ok(());
} else { } else {
// TODO: Error handling return Err(ServiceError::AgeNoRecipientsError);
unreachable!("No recipients provided");
} }
} }

View file

@ -40,6 +40,8 @@ pub enum ServiceError {
CandidateDetailsNotSet, CandidateDetailsNotSet,
#[error("Tokio join error")] #[error("Tokio join error")]
TokioJoinError(#[from] tokio::task::JoinError), TokioJoinError(#[from] tokio::task::JoinError),
#[error("Age no recipients error")]
AgeNoRecipientsError,
#[error("Age encrypt error")] #[error("Age encrypt error")]
AgeEncryptError(#[from] age::EncryptError), AgeEncryptError(#[from] age::EncryptError),
#[error("Age decrypt error")] #[error("Age decrypt error")]
@ -88,6 +90,7 @@ impl ServiceError {
ServiceError::CryptoEncryptFailed => 500, ServiceError::CryptoEncryptFailed => 500,
ServiceError::CryptoDecryptFailed => 500, ServiceError::CryptoDecryptFailed => 500,
ServiceError::CandidateDetailsNotSet => 500, ServiceError::CandidateDetailsNotSet => 500,
ServiceError::AgeNoRecipientsError => 500,
ServiceError::AgeEncryptError(_) => 500, ServiceError::AgeEncryptError(_) => 500,
ServiceError::AgeDecryptError(_) => 500, ServiceError::AgeDecryptError(_) => 500,
ServiceError::AgeKeyError(_) => 500, ServiceError::AgeKeyError(_) => 500,