public BddErrorMessage handleException(Throwable t,
HttpServletResponse response) {
if (t instanceof NestedRuntimeException) {
t = BddException.BAD_REST_CALL(t, t.getMessage());
}
BddException ex =
BddException.wrapIfNeeded(t, "REST API transport layer error.");
logger.error("rest call error", ex);
response.setStatus(getHttpErrorCode(ex.getFullErrorId()));
return new BddErrorMessage(ex.getFullErrorId(), extractErrorMessage(ex));
}