OpenTSDB: Fix showing error on query (#32421)

pull/33164/head
Zoltán Bedi 4 years ago committed by GitHub
parent bc2d90f140
commit a220e5dac2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      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<OpenTsdbQuery, OpenT
});
return this.performTimeSeriesQuery(queries, start, end).pipe(
catchError((err) => {
// 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) => {

Loading…
Cancel
Save