added exception handler for HTTP errors