private ClientResponse checkRequestException(
ClientResponse response,
RequestOptions options) {
if (response == null) return response;
ResponseType type = response.getType();
if ((type.equals(ResponseType.CLIENT_ERROR) && options.is4xxRequestException()) ||
(type.equals(ResponseType.SERVER_ERROR) && options.is5xxRequestException())) {
try {
Document<Element> doc = response.getDocument();
org.apache.abdera.protocol.error.Error error = null;
if (doc != null) {
Element root = doc.getRoot();