Hi all,
I’m trying to implement the global RSVP 'onerror'
hook, which seems to be the recommended way to capture errors that would otherwise be swallowed by promises.
However, I have several custom error handlers for Ember Data methods throughout my app like this:
store.find('client').catch(function(error) {
// handle the error gracefully.
// this code will not run if onerror handler is implemented.
})
It looks like when an ajax request fails in the RestAdapter, it calls the reject
method in a separate run loop, causing the ‘onerror’ hook to run before my custom catch()
callback can get to it. Is there any reason for doing this? Is there any better way of implementing catch callbacks on RestAdapter promises?
https://github.com/emberjs/data/blob/master/packages/ember-data/lib/adapters/rest_adapter.js#L820
Thanks!