Disabling promise-swallowing-ness of Route `model` hooks

error actions are still very much alive; they fire any time a promise returned from one of these hooks rejects. But error won’t (can’t) fire in the case of exceptions thrown directly from the hook because, as I’m suggesting, there won’t be any wrapping try/catch to catch them. Here’s a rewrite of the code sample I wrote above but with a focus on when error would fire:

App.IndexRoute = Ember.Route.extend({
  model: function() {
    // throw "blah"; -> break immediately; no `error` action
    // null.crap;    -> break immediately; no `error` action
    // foo.bar;      -> break immediately; no `error` action
    // return Ember.RSVP.reject("blah"); -> fire `error` action
    // return $.getJSON('wat.json'); -> if rejects, fire `error` action
    // return new Ember.RSVP.Promise(function(res) { throw "blah"; });
    // (above line:) fire `error` action
  }
});

You bring up a good point about Ember.onerror; I’d similarly realized this was an issue only to find that it’s already prevalent throughout Ember any time you have a 3rd party callback or use Ember.run.later; I’m gonna start a separate thread to discuss this but I think it might just make sense to have Ember.run internally wrap its callback in handleErrors.