From ab7aaed2b43ff6a3e2039755be8e73d8af9a9820 Mon Sep 17 00:00:00 2001
From: cgeek <cem.moreau@gmail.com>
Date: Wed, 6 Apr 2016 19:36:08 +0200
Subject: [PATCH] Fix: handle state change error

---
 app/js/lib/conf/routes.js | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/app/js/lib/conf/routes.js b/app/js/lib/conf/routes.js
index 986c0e8..55af323 100644
--- a/app/js/lib/conf/routes.js
+++ b/app/js/lib/conf/routes.js
@@ -250,6 +250,13 @@ module.exports = (app) => {
     $urlRouterProvider.otherwise('/');
   }]);
 
+  app.run(($rootScope, $state) => {
+    $rootScope.$on('$stateChangeError', (event, toState, toParams, fromState, fromParams, error) => {
+      console.error(error);
+      $state.go('error', { err: error.message });
+    });
+  });
+
   function resolveNetworkAutoConf(BMA) {
     return co(function *() {
       let netinterfaces = yield BMA.webmin.network.interfaces();
-- 
GitLab