1

according to the documentation of angular http API "error" method is called when server response status is 400 and above.

does this mean that when ever I want to check for status codes of 202, 204 ... to 400 I need to check them with If( status = 202 ) , if (status 204) ...

isn't there something like onViolationContrains like in GWT RPC, and RequestFactory ?, if not, how do you this.

Adelin
  • 18,144
  • 26
  • 115
  • 175
  • 1
    Seems like a duplicate of this question: http://stackoverflow.com/questions/11971213/error-401-handling-with-angularjs Good luck – Ben Lesh Nov 30 '12 at 14:34

1 Answers1

1

I think that response interceptors might be what you are looking for. Check the "response interceptors" section in http://docs.angularjs.org/api/ng.$http.

From the linked documentation:

For purposes of global error handling, authentication or any kind of synchronous or asynchronous preprocessing of received responses, it is desirable to be able to intercept responses for http requests before they are handed over to the application code that initiated these requests.

pkozlowski.opensource
  • 117,202
  • 60
  • 326
  • 286