- Improve email notification cases for unexpected exceptions.

This commit is contained in:
Paulo Gustavo Veiga
2012-08-14 23:55:13 -03:00
parent 6d7c12ca60
commit 09ed4f68b7
9 changed files with 113 additions and 50 deletions

View File

@@ -165,7 +165,7 @@ final public class NotificationService {
final String errorReporterEmail = mailer.getErrorReporterEmail();
if (errorReporterEmail != null && !errorReporterEmail.isEmpty()) {
mailer.sendEmail(mailer.getServerSenderEmail(), errorReporterEmail, "[WiseMapping] Editor error from " + user.getEmail(), model,
"editorErrorReport.vm");
"errorNotification.vm");
}
} catch (Exception e) {
handleException(e);
@@ -183,7 +183,24 @@ final public class NotificationService {
final String errorReporterEmail = mailer.getErrorReporterEmail();
if (errorReporterEmail != null && !errorReporterEmail.isEmpty()) {
mailer.sendEmail(mailer.getServerSenderEmail(), errorReporterEmail, "[WiseMapping] Export error from " + user.getEmail(), model,
"editorErrorReport.vm");
"errorNotification.vm");
}
} catch (Exception e) {
handleException(e);
}
}
public void reportUnexpectedError(@NotNull Throwable exception, @Nullable User user, @NotNull String userAgent) {
try {
final Map<String, Object> model = new HashMap<String, Object>();
model.put("user", user);
model.put("errorMsg", stackTraceToString(exception));
model.put("userAgent", userAgent);
final String errorReporterEmail = mailer.getErrorReporterEmail();
if (errorReporterEmail != null && !errorReporterEmail.isEmpty()) {
mailer.sendEmail(mailer.getServerSenderEmail(), errorReporterEmail, "[WiseMapping] Unexpected error from " + (user != null ? user.getEmail() : "anonymous"), model,
"errorNotification.vm");
}
} catch (Exception e) {
handleException(e);