New error handling for http requests