}
private void reportError(String message, Exception ex, int status) {
LOG.warning(message);
Response response = Response.status(status).type("text/plain").entity(message).build();
if (ex == null) {
throw status < 500 ? new ClientErrorException(response) : new ServerErrorException(response);
} else {
throw status < 500 ? new ClientErrorException(response, ex) : new ServerErrorException(response, ex);
}
}