下面是保存模型的示例函数,并涉及错误处理。我想把控制流放在错误处理中,所以对于特定类型的错误,一件事发生,另一类错误,另一件事情发生,但我似乎无法用控制台日志或调试器检查xhr。
propChange: function (newName) {
var self = this;
var oldProp = this.model.get('prop');
this.model.save({ name: newProp }, {
success: function (data, textStatus, xhr) {
...
},
error: function (model, xhr) {
//I can't console.log anything hear, use debugger, or put a break point here so how do I investigate or experiment with what model and xhr could be at this point?
}
});
},