mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-24 13:55:57 +00:00
Fix error message when email fails to send.
Closes elastic/elasticsearch#195 Original commit: elastic/x-pack-elasticsearch@7256a32505
This commit is contained in:
parent
3e9c109079
commit
b70bdb2b89
@ -95,7 +95,7 @@ public class EmailAction extends Action<EmailAction.Result> {
|
|||||||
|
|
||||||
} catch (EmailException ee) {
|
} catch (EmailException ee) {
|
||||||
logger.error("could not send email [{}] for watch [{}]", ee, actionId, ctx.watch().name());
|
logger.error("could not send email [{}] for watch [{}]", ee, actionId, ctx.watch().name());
|
||||||
return new Result.Failure("could not send email. error: " + ee.getMessage());
|
return new Result.Failure("could not send email for action [" + actionId + "]. error: " + ee.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ public class InternalEmailService extends AbstractLifecycleComponent<InternalEma
|
|||||||
public EmailSent send(Email email, Authentication auth, Profile profile, String accountName) {
|
public EmailSent send(Email email, Authentication auth, Profile profile, String accountName) {
|
||||||
Account account = accounts.account(accountName);
|
Account account = accounts.account(accountName);
|
||||||
if (account == null) {
|
if (account == null) {
|
||||||
throw new EmailException("failed to send email [" + email + "] via account [" + accountName + "]. account does not exist");
|
throw new EmailException("failed to send email with subject [" + email.subject() + "] via account [" + accountName + "]. account does not exist");
|
||||||
}
|
}
|
||||||
return send(email, auth, profile, account);
|
return send(email, auth, profile, account);
|
||||||
}
|
}
|
||||||
@ -65,7 +65,7 @@ public class InternalEmailService extends AbstractLifecycleComponent<InternalEma
|
|||||||
try {
|
try {
|
||||||
email = account.send(email, auth, profile);
|
email = account.send(email, auth, profile);
|
||||||
} catch (MessagingException me) {
|
} catch (MessagingException me) {
|
||||||
throw new EmailException("failed to send email [" + email + "] via account [" + account.name() + "]", me);
|
throw new EmailException("failed to send email with subject [" + email.subject() + "] via account [" + account.name() + "]", me);
|
||||||
}
|
}
|
||||||
return new EmailSent(account.name(), email);
|
return new EmailSent(account.name(), email);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user