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

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to