-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Composition of error handler + interceptors should be more flexible #4013
Comments
+1 |
+1 |
+1 |
+1 I also have almost the same use-case as @mkotsur . |
I've looked at the issue about how interceptors work in a different issue (re the "The order is kind of illogical: global interceptor -> error handler -> local interceptor;" problem), but I didn't submit a patch because I believe the current limitations were a conscious decision, and it would be a breaking change either way. Still, could look at going with (or at least discussing) a different model for the interceptor pipeline |
+1 |
having this issue as well. Anyone know of a possible workaround? :/ |
Ended up by adding a flag to the |
I think this is one of those cases were you can't make everyone happy. (Some people would want to one order, some the other and making every detail configurable will just make the API unleasant for everyone.) Also note that there are two distinct interceptor pipelines at play here (the one for Considering that the current implementation was a conscious decision and that it is already possible to achive what you want (in a reasonable - if not ideal - way), I am going to close this. That said, I admit that the current interceptors/tranformRequest/transformResponse story for |
For
ngResource
there are 3 places to handle HTTP errors:$httpProvider
(further global interceptor),$resource
(further local interceptor),The demo of all 3 ways is here: http://plnkr.co/edit/wWGzbEUj1Gr2KwmxTrmx
There are 2 problems with this:
Now the use-case: I want to make user aware of every failed request. But:
User
resource and it returns me 404 not found, I always want to redirect somewhere;Currently it's only possible to talk from error handler to local interceptor by setting some
response._handled = true
(not really nice), but global interceptor is always executed first and thus completely out of control.The solution could be:
The text was updated successfully, but these errors were encountered: