I might be able to give you an idea of how you can achieve it through the run block.
app.run(function (StateInterceptor, FPSSO, HTTPResponseCode, $state, SessionManager, notifications, Utils, $timeout) {
StateInterceptor.startService();
var httpSecurityInterceptor = function(response, deferred){
var propagatePromise = true;
switch(response.status){
case HTTPResponseCode.UNAUTHORIZED:
SessionManager.Logout();
notifications.showErrorMessage("Your session has expired. Please sign in again.", "Error");
$state.go('Logout', {isLogout: true, returnUrl: $state.current.name});
propagatePromise = false;
break;
default:
var res = Utils.ExtractResponse(response);
res.status = response.status;
deferred.reject(res);
}
return propagatePromise;
}
FPSSO.API.setErrorInterceptor(httpSecurityInterceptor);
You can see that in the Unauthorized case of the switch statement, I am able to access the $state.current and route my app to 'Logout'. This is a code that is deployed on production so I am pretty sure it works.
Try to achieve something similar.