diff --git a/backend/src/confirmation.rs b/backend/src/confirmation.rs index 992a06b..3c0914e 100644 --- a/backend/src/confirmation.rs +++ b/backend/src/confirmation.rs @@ -77,6 +77,8 @@ pub fn send_confirmation_email(address: &str, action: &Action, token: &str) -> R let email = log_err!(email, warn)?; - log_err!(MAILER.send(&email), warn)?; - Ok(()) + match log_err!(MAILER.send(&email), warn){ + Ok(_) => Ok(()), + Err(_) => Err(SpecialErrors::MailErr)? + } } diff --git a/backend/src/errors.rs b/backend/src/errors.rs index 284a1e8..bdce6b7 100644 --- a/backend/src/errors.rs +++ b/backend/src/errors.rs @@ -44,6 +44,8 @@ pub enum SpecialErrors { InexistingUser, #[error("The key is either expired or uses an obsolete cipher!")] InvalidCert, + #[error("Error while sending email")] + MailErr, #[error("Could not parse keyblock")] MalformedCert, #[error("Could not parse user email: malformed email")] @@ -94,6 +96,7 @@ impl ResponseError for CompatErr { SpecialErrors::InexistingUser => StatusCode::NOT_FOUND, SpecialErrors::InvalidCert => StatusCode::BAD_REQUEST, SpecialErrors::EmailMissing => StatusCode::BAD_REQUEST, + SpecialErrors::MailErr => StatusCode::INTERNAL_SERVER_ERROR, SpecialErrors::MalformedCert => StatusCode::BAD_REQUEST, SpecialErrors::MalformedEmail => StatusCode::BAD_REQUEST, SpecialErrors::MissingFile => StatusCode::NOT_FOUND,