From 4c41d7e7fb609bbafbaf940336859f5acc2477d0 Mon Sep 17 00:00:00 2001 From: Tobias Skarhed Date: Fri, 24 Jan 2020 15:55:36 +0100 Subject: [PATCH] Template vars: Add error message for failed query var (#21731) --- public/app/features/templating/variable_srv.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/public/app/features/templating/variable_srv.ts b/public/app/features/templating/variable_srv.ts index 25ee498a2e2..cc38359e4de 100644 --- a/public/app/features/templating/variable_srv.ts +++ b/public/app/features/templating/variable_srv.ts @@ -11,9 +11,10 @@ import { TimeSrv } from 'app/features/dashboard/services/TimeSrv'; import { DashboardModel } from 'app/features/dashboard/state/DashboardModel'; // Types -import { TimeRange } from '@grafana/data'; +import { TimeRange, AppEvents } from '@grafana/data'; import { CoreEvents } from 'app/types'; import { UrlQueryMap } from '@grafana/runtime'; +import { appEvents } from 'app/core/core'; export class VariableSrv { dashboard: DashboardModel; @@ -71,9 +72,14 @@ export class VariableSrv { }); }); - return this.$q.all(promises).then(() => { - this.dashboard.startRefresh(); - }); + return this.$q + .all(promises) + .then(() => { + this.dashboard.startRefresh(); + }) + .catch(e => { + appEvents.emit(AppEvents.alertError, ['Template variable service failed', e.message]); + }); } processVariable(variable: any, queryParams: any) {