(js) Improve error handling in Contacts routing

pull/110/head
Francis Lachapelle 2015-10-09 16:19:28 -04:00
parent 7ddf7be705
commit e5fdc28241
1 changed files with 7 additions and 3 deletions

View File

@ -130,10 +130,14 @@
/**
* @ngInject
*/
runBlock.$inject = ['$rootScope'];
function runBlock($rootScope) {
runBlock.$inject = ['$rootScope', '$log', '$state'];
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) {
console.error(event, current, previous, rejection);
$log.error(event, current, previous, rejection);
});
}