Added HTTP error handling.