For instance in following interceptor : (we are using heroku, when we set the maintenance mode to on the router returns 503 status, for which we need to go to a different state (page)
// @ngInject
export function maintenanceInterceptor($q, $injector) {
return {
responseError: (response) => {
if (response.status === 503) {
if ($injector.has('$state')) {
const state = $injector.get('$state');
state.go('maintenance', {}, { location: false });
}
}
return $q.reject(response);
},
};
}
This now gets logged as a possible unhandled rejection. I've tried
export function maintenanceInterceptor($q, $injector) {
return {
responseError: (response) => {
if (response.status === 503) {
if ($injector.has('$state')) {
const state = $injector.get('$state');
state.go('maintenance', {}, { location: false });
return $q.reject(response).catch(angular.noop);
}
}
return $q.reject(response);
},
};
}
But this results in the $http.then(success, failed) success callback called ??? which is weird
Any advice is much appreciated, i don't want to disable the error by $qProvider.errorOnUnhandledRejections(false);
because we really want to only disable for specific reasons/use-cases
Kr