I\'m trying to write a generic error handler for my website using $http\'
s interceptors but they don\'t seem to be able to do what I want to do.
I place
You can probably check the status of the ResponseError. When an API is offline that is 0 (until Angular 1.3.18) or -1 (since Angular 1.3.19):
angular.module("services.interceptor", arguments).config(function($httpProvider) {
$httpProvider.interceptors.push(function($q) {
return {
responseError: function(rejection) {
if(rejection.status <= 0) {
window.location = "noresponse.html";
return;
}
return $q.reject(rejection);
}
};
});
});