handle RSVP.Hash errors from model hook
Question
Say I am returning an RSVP.Hash from a model hook like this:
model: function() {
hash = {
users: App.User.find(),
contacts: App.Contact.find()
};
return Ember.RSVP.hash(hash);
}
This works fine for me in the good case but what about the bad case where one of them returns something other than an http 200? How can I handle errors in this scenario?
Solution
to have more granular control over errors when using promise composing functions you can use Ember.RSVP.allSettled
and Ember.RSVP.hashSettled
.
related docs and examples:
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow