RSVP.all没有在ember-data save失败时触发故障回调

时间:2015-04-23 21:46:02

标签: javascript ember.js ember-data promise rsvp.js

我在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

我做错了什么?

0 个答案:

没有答案