use of com.haulmont.cuba.core.app.ExceptionReportService in project cuba by cuba-platform.
the class JXErrorPaneExt method sendSupportEmail.
private void sendSupportEmail(ErrorInfo jXErrorPaneInfo) {
Configuration configuration = AppBeans.get(Configuration.NAME);
ExceptionReportService reportService = AppBeans.get(ExceptionReportService.NAME);
ClientConfig clientConfig = configuration.getConfig(ClientConfig.class);
TopLevelFrame mainFrame = App.getInstance().getMainFrame();
Messages messages = AppBeans.get(Messages.NAME);
Locale locale = App.getInstance().getLocale();
try {
TimeSource timeSource = AppBeans.get(TimeSource.NAME);
String date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(timeSource.currentTimestamp());
UserSessionSource userSessionSource = AppBeans.get(UserSessionSource.NAME);
User user = userSessionSource.getUserSession().getUser();
Map<String, Object> binding = new HashMap<>();
binding.put("timestamp", date);
binding.put("errorMessage", jXErrorPaneInfo.getBasicErrorMessage());
binding.put("stacktrace", getStackTrace(jXErrorPaneInfo.getErrorException()));
binding.put("systemId", clientConfig.getSystemID());
binding.put("userLogin", user.getLogin());
if (MapUtils.isNotEmpty(additionalExceptionReportBinding)) {
binding.putAll(additionalExceptionReportBinding);
}
reportService.sendExceptionReport(clientConfig.getSupportEmail(), ImmutableMap.copyOf(binding));
mainFrame.showNotification(messages.getMainMessage("errorPane.emailSent", locale), Frame.NotificationType.TRAY);
} catch (Throwable e) {
mainFrame.showNotification(messages.getMainMessage("errorPane.emailSendingErr", locale), Frame.NotificationType.ERROR);
log.error("Can't send error report", e);
}
}
Aggregations