String messageFormat = Messages.getMessage("exceptionOccurredDuringInvocation");
String exceptionName = t.getClass().getSimpleName();
if (t instanceof WebApplicationException) {
WebApplicationException wae = (WebApplicationException)t;
int statusCode = wae.getResponse().getStatus();
Status status = Response.Status.fromStatusCode(statusCode);
String statusSep = "";
String statusMessage = "";
if (status != null) {
statusSep = " - ";
statusMessage = status.toString();
}
exceptionName =
String.format("%s (%d%s%s)", exceptionName, statusCode, statusSep, statusMessage);
if (statusCode >= 500) {
logger.error(String.format(messageFormat, exceptionName), t);