error handling for http request object