1

I have a simple backend - Php RESTful API

When data is not available for specific parameters (for instance, a date and company_id) - we return an error (say 401) along with a message

In Backbone, I am then able to deal with the error / success of requests with:

data = {date:"2013-01-01",company_id:"500"}
model.fetch({data:data})
  .success( ()=> @dealWithSuccess )
  .error( ()=> @dealWithError )

This is fine but in the console I get notifications on network failures for the GET and OPTIONS requests

How can I have them not show up in the console? as I don't want clients to see this

4

1 回答 1

1

您的状态代码401是有效的RFC 2616 错误

默认的Google Chrome 控制台输出与您自己的应用程序调试输出混合在一起,知道控制台的任何人都可以查看。

Chrome 将有效的 RFC 错误显示为红色消息:

GOogle Chrome 控制台示例输出

您可以响应代码更改为非 RFC 状态代码(如999)以摆脱着色。

XMLHttpRequest Object这与故障无关。

于 2013-05-16T22:17:15.083 回答