int statusCode = statusLine.getStatusCode();
if (HttpSC.isClientError(statusCode) || HttpSC.isServerError(statusCode)) {
log.debug(format("[%d] %s %s", id, statusLine.getStatusCode(), statusLine.getReasonPhrase()));
// Error responses can have bodies so it is important to clear up.
EntityUtils.consume(response.getEntity());
throw new HttpException(statusLine.getStatusCode(), statusLine.getReasonPhrase());
}
// Redirects are followed by HttpClient.
if (handler != null)
handler.handle(baseURI, response);
} catch (IOException ex) {
throw new HttpException(ex);
}
}