Adds http request error handling