mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fix(error handling): improved dashboard init error handling and notifications
This commit is contained in:
@@ -54,15 +54,20 @@ export class DashboardCtrl {
|
||||
$scope.setWindowTitleAndTheme();
|
||||
|
||||
$scope.appEvent("dashboard-initialized", $scope.dashboard);
|
||||
}).catch(function(err) {
|
||||
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($scope.dashboardInitError.bind(this));
|
||||
} 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() {
|
||||
dynamicDashboardSrv.update($scope.dashboard);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user