Fix to error handling: CR2

This commit is contained in:
Levko Kravets 2018-01-03 15:28:15 +02:00
parent effb212e4b
commit aa970a0afb
2 changed files with 2 additions and 12 deletions

View File

@ -14,7 +14,7 @@ export default function init(ngModule) {
ngModule.component('appView', {
template,
controller($rootScope, $scope, $route, $timeout, Auth) {
controller($rootScope, $scope, $route, Auth) {
this.showHeaderAndFooter = false;
this.error = null;
@ -54,16 +54,6 @@ export default function init(ngModule) {
}
});
$rootScope.$on('$routeChangeSuccess', () => {
// Show any error if it occurred during route changing
this.error = handler.error instanceof Error ? handler.error : null;
// Wait for error for some grace period - to catch errors during
// controller instantiation, in example
$timeout(() => {
this.error = handler.error instanceof Error ? handler.error : null;
}, 50);
});
$rootScope.$on('$routeChangeError', (event, current, previous, rejection) => {
throw new PromiseRejectionError(rejection);
});

View File

@ -5,7 +5,7 @@
"main": "index.js",
"scripts": {
"start": "webpack-dev-server",
"start-demo": "REDASH_BACKEND=https://dev.redashapp.com npm start",
"dev": "REDASH_BACKEND=https://dev.redashapp.com npm start",
"build": "rm -rf ./client/dist/ && NODE_ENV=production node node_modules/.bin/webpack",
"watch": "webpack --watch --progress --colors -d"
},