In my Ember RSVP code, I'm not able to get any error handlers called, even though I see that my 'reject' function is executing successfully. Code:
var promise = new Promise(function(resolve, reject) {
doStuff().then(function() {
resolve(1);
}, function() {
console.log('rejected!');
reject('This has been rejected!');
});
});
var allPromises = [promise]; // Real code has more than one; just one for demonstration.
Ember.RSVP.all(allPromises)
.then(
function() {
console.log('I am called!');
},
function() { console.log('I am never called!');})
.catch(function(err) {
console.log('I am never called, either.');
});
However, I do see the 'rejected!' message in the console. What have I done wrong here? Shouldn't the catch() fire since the reject() worked properly?
DEBUG: Ember : 1.9.0-beta.1
DEBUG: Ember Data : 1.0.0-beta.12
DEBUG: jQuery : 1.9.1
Docs: https://github.com/tildeio/rsvp.js
They state 'Sometimes you might want to work with many promises at once. If you pass an array of promises to the all() method it will return a new promise that will be fulfilled when all of the promises in the array have been fulfilled; or rejected immediately if any promise in the array is rejected.'