@Override
public T apply(Response response) {
try {
final String body = response.getEntity();
final Collection<ErrorCollection> errorMessages = extractErrors(response.getStatusCode(), body);
throw new RestClientException(errorMessages, response.getStatusCode());
} catch (JSONException e) {
throw new RestClientException(e, response.getStatusCode());
}
}
};
}