From a220e5dac286481928ea32f3f5ea0ee435c397c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Bedi?= Date: Tue, 20 Apr 2021 14:10:05 +0200 Subject: [PATCH] OpenTSDB: Fix showing error on query (#32421) --- public/app/plugins/datasource/opentsdb/datasource.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/opentsdb/datasource.ts b/public/app/plugins/datasource/opentsdb/datasource.ts index 59847c96de2..59d861b5121 100644 --- a/public/app/plugins/datasource/opentsdb/datasource.ts +++ b/public/app/plugins/datasource/opentsdb/datasource.ts @@ -1,7 +1,7 @@ import angular from 'angular'; import _ from 'lodash'; import { Observable, of } from 'rxjs'; -import { map } from 'rxjs/operators'; +import { catchError, map } from 'rxjs/operators'; import { FetchResponse, getBackendSrv } from '@grafana/runtime'; import { AnnotationEvent, @@ -84,6 +84,10 @@ export default class OpenTsDatasource extends DataSourceApi { + // Throw the error message here instead of the whole object to workaround the error parsing error. + throw err?.data?.error?.message || 'Error performing time series query.'; + }), map((response) => { const metricToTargetMapping = this.mapMetricsToTargets(response.data, options, this.tsdbVersion); const result = _.map(response.data, (metricData: any, index: number) => {