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

mate64
  • 9,876
  • 17
  • 64
  • 96
imrane
  • 1,542
  • 2
  • 16
  • 29

1 Answers1

1

Your Status code 401 is a valid RFC 2616 error.

The default Google Chrome console output is mixed with your own app debugging output and is viewable by anyone who knows the console.

Chrome displays valid RFC errors as red colored messages:

GOogle Chrome console example output

You could change the response code to a non RFC status code (like 999) to get rid off the coloration.

This has nothing to do with an XMLHttpRequest Object malfunction.

Community
  • 1
  • 1
mate64
  • 9,876
  • 17
  • 64
  • 96
  • What would be your suggestion given my specific situation? Leave it since clients won't be viewing the console or change my status codes? – imrane May 16 '13 at 22:32
  • @imrane The [rfc2616](http://tools.ietf.org/html/rfc2616) s only a recommendation. Feel free to change the status codes. Remember: The console is a tool *for developers* and the red color is a indicator for you, that something was going wrong. As long it's not a critical application or server error, **do not worry**. – mate64 May 17 '13 at 07:34