mirror of
https://git.verdigado.com/NB-Public/simple-wkd.git
synced 2024-10-30 01:25:53 +01:00
Add special mail when failing to send mail
This commit is contained in:
parent
ab10c7f9e9
commit
7cef05a7f9
2 changed files with 7 additions and 2 deletions
|
@ -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)?
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue