Hacker News new | ask | show | jobs
by noduerme 1459 days ago
At this point I like to wrap my remoting code (including optional retries) into async functions that return a promise. The promise resolves with a result from the server, or rejects with any sort of error that can come from an XHR (or now, fetch), and the consumer can decide what to do with that.

In my software I almost never do automatic retries, rather I warn the user that there was a connection error if necessary, and revert whatever state was waiting on a call. In my view anything that can fail silently probably does not need to be retried right now.