如何从骨干保存请求中的错误消息中检查xhr对象和模型?

时间:2016-06-22 17:46:27

标签: backbone.js error-handling model

下面是保存模型的示例函数,并涉及错误处理。我想把控制流放在错误处理中,所以对于特定类型的错误,一件事发生,另一类错误,另一件事情发生,但我似乎无法用控制台日志或调试器检查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?
        }
    });
},

0 个答案:

没有答案