Chore: fixes throwing errors on 200 response with influxdb datasource (#24848)

* Chore: fixes throwing errors on 200 response with influxdb datasource

* Chore: changes influxdb error prefix from error to influxdb error
This commit is contained in:
Lukas Siatka
2020-05-25 17:56:16 +02:00
committed by GitHub
parent 1e4e2642bf
commit 7bf5b395b6
2 changed files with 49 additions and 0 deletions

View File

@@ -322,6 +322,15 @@ export default class InfluxDatasource extends DataSourceApi<InfluxQuery, InfluxO
.datasourceRequest(req)
.then(
(result: any) => {
if (result.data && result.data.results) {
const errors = result.data.results.filter((elem: any) => elem.error);
if (errors.length > 0) {
throw {
message: 'InfluxDB Error: ' + errors[0].error,
data: result.data,
};
}
}
return result.data;
},
(err: any) => {