(js) Improve error handling in Contacts routing

This commit is contained in:
Francis Lachapelle 2015-10-09 16:19:28 -04:00
parent 7ddf7be705
commit e5fdc28241

View file

@ -130,10 +130,14 @@
/** /**
* @ngInject * @ngInject
*/ */
runBlock.$inject = ['$rootScope']; runBlock.$inject = ['$rootScope', '$log', '$state'];
function runBlock($rootScope) { function runBlock($rootScope, $log, $state) {
$rootScope.$on('$stateChangeError', function(event, toState, toParams, fromState, fromParams, error) {
$log.error(error);
$state.go('app');
});
$rootScope.$on('$routeChangeError', function(event, current, previous, rejection) { $rootScope.$on('$routeChangeError', function(event, current, previous, rejection) {
console.error(event, current, previous, rejection); $log.error(event, current, previous, rejection);
}); });
} }