mardi 21 août 2018

How should DS.AbortErrors ("The adapter operation was aborted") be handled?

I'm currently running Ember Data 2.18 and am having difficulties finding documentation on how to gracefully handle DS.AbortErrors/DS.AdapterErrors. Their documentation reads:

A DS.AbortError is used by an adapter to signal that a request to the external API was aborted. For example, this can occur if the user navigates away from the current page after a request to the external API has been initiated but before a response has been received.

This is consistent with how I've been reproducing the errors – by refreshing the page before the route/model has finished getting responses back from an external API. This is all fine and makes sense, but is there a way to gracefully handle these errors? I'm seeing a tonne of them in New Relic where we monitor our errors and its becoming quite noisy.

For reference, this is the error getting returned when a DS.AbortError is thrown:

Uncaught Error: The adapter operation was aborted

And here is the documentation I've been looking at.

Thanks in advance for your time!




Aucun commentaire:

Enregistrer un commentaire