[Minor] Catch throwable mail sending exceptions
This commit is contained in:
parent
7fc6c2d8c8
commit
2ae0389f2c
|
@ -49,7 +49,7 @@ public class SmtpMailHandler extends MailHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendMail(String subject, String text, String recipients, String attachment, String fileName,
|
public void sendMail(String subject, String text, String recipients, String attachment, String fileName,
|
||||||
String type) {
|
String type) {
|
||||||
SmtpMailer.getInstance().sendMail(subject, text, recipients, attachment, fileName, type);
|
SmtpMailer.getInstance().sendMail(subject, text, recipients, attachment, fileName, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,14 +60,14 @@ public class SmtpMailHandler extends MailHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendMailAsync(String subject, String text, String recipients, String attachment, String fileName,
|
public void sendMailAsync(String subject, String text, String recipients, String attachment, String fileName,
|
||||||
String type) {
|
String type) {
|
||||||
getExecutorService("Mail").submit(() -> doSendMail(subject, text, recipients, attachment, fileName, type));
|
getExecutorService("Mail").submit(() -> doSendMail(subject, text, recipients, attachment, fileName, type));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doSendMail(String subject, String text, String recipients) {
|
private void doSendMail(String subject, String text, String recipients) {
|
||||||
try {
|
try {
|
||||||
SmtpMailer.getInstance().sendMail(subject, text, recipients);
|
SmtpMailer.getInstance().sendMail(subject, text, recipients);
|
||||||
} catch (Exception e) {
|
} catch (Throwable e) {
|
||||||
logger.error("Failed to send mail \"" + subject + "\" to " + recipients, e);
|
logger.error("Failed to send mail \"" + subject + "\" to " + recipients, e);
|
||||||
|
|
||||||
if (hasComponent(OperationsLog.class)) {
|
if (hasComponent(OperationsLog.class)) {
|
||||||
|
@ -81,10 +81,10 @@ public class SmtpMailHandler extends MailHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doSendMail(String subject, String text, String recipients, String attachment, String fileName,
|
private void doSendMail(String subject, String text, String recipients, String attachment, String fileName,
|
||||||
String type) {
|
String type) {
|
||||||
try {
|
try {
|
||||||
SmtpMailer.getInstance().sendMail(subject, text, recipients, attachment, fileName, type);
|
SmtpMailer.getInstance().sendMail(subject, text, recipients, attachment, fileName, type);
|
||||||
} catch (Exception e) {
|
} catch (Throwable e) {
|
||||||
logger.error("Failed to send mail \"" + subject + "\" to " + recipients + " with attachment " + fileName,
|
logger.error("Failed to send mail \"" + subject + "\" to " + recipients + " with attachment " + fileName,
|
||||||
e);
|
e);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue