Added http error handling to the http client.