improve error handling for http request to github