More robust HTTP error handling.