I have a model with belongsto relationships. When the related records cannot be found, an exception is thrown. This is ok, but the default promise error handling code prevents the run-loop from from flushing the remaining tasks. It just drops everything and dies, leaving all those unresolved promises in limbo.
The code in question:
RSVP.onerrorDefault = function(error) {
if (error instanceof Error) {
if (Ember.testing) {
// ES6TODO: remove when possible
if (!Test && Ember.__loader.registry[testModuleName]) {
Test = requireModule(testModuleName)['default'];
}
if (Test && Test.adapter) {
Test.adapter.exception(error);
} else {
throw error;
}
} else if (Ember.onerror) {
Ember.onerror(error);
} else {
Logger.error(error.stack);
Ember.assert(error, false);
}
}
};
If no Ember error handler is defined, or the default promise error handler is not changed, this code will throw an exception. That exception then kills the run loop and permanently suspends any promise chains still in queue.
Its a problem, but at least I discovered how to deal with it, by making an error handler… (Ember.K works until I get inspired).