0
0
Fork 0
mirror of https://git.verdigado.com/NB-Public/simple-wkd.git synced 2024-10-30 03:05:51 +01:00

Add special mail when failing to send mail

This commit is contained in:
Delta1925 2023-04-18 23:49:18 +02:00
parent ab10c7f9e9
commit 7cef05a7f9
No known key found for this signature in database
GPG key ID: 1C21ACE44193CB25
2 changed files with 7 additions and 2 deletions

View file

@ -77,6 +77,8 @@ pub fn send_confirmation_email(address: &str, action: &Action, token: &str) -> R
let email = log_err!(email, warn)?; let email = log_err!(email, warn)?;
log_err!(MAILER.send(&email), warn)?; match log_err!(MAILER.send(&email), warn){
Ok(()) Ok(_) => Ok(()),
Err(_) => Err(SpecialErrors::MailErr)?
}
} }

View file

@ -44,6 +44,8 @@ pub enum SpecialErrors {
InexistingUser, InexistingUser,
#[error("The key is either expired or uses an obsolete cipher!")] #[error("The key is either expired or uses an obsolete cipher!")]
InvalidCert, InvalidCert,
#[error("Error while sending email")]
MailErr,
#[error("Could not parse keyblock")] #[error("Could not parse keyblock")]
MalformedCert, MalformedCert,
#[error("Could not parse user email: malformed email")] #[error("Could not parse user email: malformed email")]
@ -94,6 +96,7 @@ impl ResponseError for CompatErr {
SpecialErrors::InexistingUser => StatusCode::NOT_FOUND, SpecialErrors::InexistingUser => StatusCode::NOT_FOUND,
SpecialErrors::InvalidCert => StatusCode::BAD_REQUEST, SpecialErrors::InvalidCert => StatusCode::BAD_REQUEST,
SpecialErrors::EmailMissing => StatusCode::BAD_REQUEST, SpecialErrors::EmailMissing => StatusCode::BAD_REQUEST,
SpecialErrors::MailErr => StatusCode::INTERNAL_SERVER_ERROR,
SpecialErrors::MalformedCert => StatusCode::BAD_REQUEST, SpecialErrors::MalformedCert => StatusCode::BAD_REQUEST,
SpecialErrors::MalformedEmail => StatusCode::BAD_REQUEST, SpecialErrors::MalformedEmail => StatusCode::BAD_REQUEST,
SpecialErrors::MissingFile => StatusCode::NOT_FOUND, SpecialErrors::MissingFile => StatusCode::NOT_FOUND,