frontendApi.LOG_REMOTE.send(logRecord, new ApiCallback<LogFatalRecordResponse>() {
@Override
public void onMessageReceived(final LogFatalRecordResponse message) {
StatusMessage msg = new StatusMessage(statusManager, MessageType.FATAL, FATAL_MESSAGE);
msg.addAction(StatusMessage.FEEDBACK_ACTION);
msg.addAction(StatusMessage.RELOAD_ACTION);
String stackTrace;
if (!StringUtils.isNullOrEmpty(message.getStackTrace())) {
stackTrace = message.getStackTrace();
} else {
stackTrace = ExceptionUtils.getStackTraceAsString(exception);
}
msg.setLongText(calculateLongText(stackTrace));
msg.fire();
}
private String calculateLongText(String stackTrace) {
return "Client exception at " + currentWindowLocation + "\n\nRecent history:\n\t"
+ recentHistory.join("\n\t") + "\n\n" + stackTrace;
}
@Override
public void onFail(FailureReason reason) {
StatusMessage msg = new StatusMessage(statusManager, MessageType.FATAL, FATAL_MESSAGE);
msg.addAction(StatusMessage.FEEDBACK_ACTION);
msg.addAction(StatusMessage.RELOAD_ACTION);
msg.setLongText(calculateLongText(ExceptionUtils.getStackTraceAsString(exception)));
msg.fire();
}
});
}