add error handling for http request