我在Ember.RSVP.all
聚合器承诺中包含一组保存,并且当单个故障触发时,故障回调未触发。我也试过Ember.RSVP.allSettled
。
我正在使用ember-data的活动模型适配器插件,我的后端返回422 Not Processable,它应该触发故障回调。
var blueprintSavePromises = blueprints.map(function(bp){
return bp.save().then(function(){
console.log("individual save was successful");
}, function(){
console.log("individual save failed");
});
});
var allBlueprintPromises = Ember.RSVP.allSettled(blueprintSavePromises);
allBlueprintPromises.then(function(){
console.log("collection was successful");
}).catch(function(){
console.log("collection was not successful");
});
// PUT http://test/test 422 (Unprocessable Entity)
// jquery.js:9659 XHR finished loading: PUT ...
// test-file.js:94 individual save failed
// test-file.js:110 collection was successful
我做错了什么?