opensourcecontributors
opensourcecontributors copied to clipboard
Handle errors in which the server is down
When the server is down, the responseError handler is still called. But then rejection.data is null, which causes another error! :cry:
function ConfigureErrorHandler($httpProvider) {
$httpProvider.interceptors.push(function($q, $rootScope, $log, $injector) {
return {
'responseError': function(rejection) {
$log.debug(rejection);
$rootScope.errorDescription = rejection.data.error;