Commit b4493155 by Torkel Ödegaard

fix(error handling): improved dashboard init error handling and notifications

parent c1b7bd0f
...@@ -54,15 +54,20 @@ export class DashboardCtrl { ...@@ -54,15 +54,20 @@ export class DashboardCtrl {
$scope.setWindowTitleAndTheme(); $scope.setWindowTitleAndTheme();
$scope.appEvent("dashboard-initialized", $scope.dashboard); $scope.appEvent("dashboard-initialized", $scope.dashboard);
}).catch(function(err) { }).catch($scope.dashboardInitError.bind(this));
if (err.data && err.data.message) { err.message = err.data.message; }
$scope.appEvent("alert-error", ['Dashboard init failed', 'Template variables could not be initialized: ' + err.message]);
});
} catch (err) { } catch (err) {
$scope.appEvent("alert-error", ['Dashboard init failed', err.message]); $scope.dashboardInitError(err);
} }
}; };
$scope.dashboardInitError = function(err) {
console.log('Dashboard init failed', err);
if (err.data && err.data.message) {
err.message = err.data.message;
}
$scope.appEvent("alert-error", ['Dashboard init failed', err.message]);
};
$scope.templateVariableUpdated = function() { $scope.templateVariableUpdated = function() {
dynamicDashboardSrv.update($scope.dashboard); dynamicDashboardSrv.update($scope.dashboard);
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment