final int statusCode = statusLine.getStatusCode();
if(statusCode >= HttpStatus.SC_OK && statusCode < HttpStatus.SC_MULTIPLE_CHOICES) {
return new Response(response);
}
else if(statusCode == HttpStatus.SC_NOT_FOUND) {
throw new NotFoundException(new Response(response));
}
else if(statusCode == HttpStatus.SC_UNAUTHORIZED) {
throw new AuthorizationException(new Response(response));
}
throw new GenericException("Unexpected response", response.getAllHeaders(), statusLine);