Errors: support errors with frame data from backend responses (#24176)
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
import { Observable, from } from 'rxjs';
|
||||
import { config } from '..';
|
||||
import { getBackendSrv } from '../services';
|
||||
import { toDataQueryResponse } from './queryResponse';
|
||||
|
||||
const ExpressionDatasourceID = '__expr__';
|
||||
|
||||
@@ -94,7 +95,11 @@ export class DataSourceWithBackend<
|
||||
requestId,
|
||||
})
|
||||
.then((rsp: any) => {
|
||||
return this.toDataQueryResponse(rsp?.data);
|
||||
return toDataQueryResponse(rsp);
|
||||
})
|
||||
.catch(err => {
|
||||
err.isHandled = true; // Avoid extra popup warning
|
||||
return toDataQueryResponse(err);
|
||||
});
|
||||
|
||||
return from(req);
|
||||
@@ -109,16 +114,6 @@ export class DataSourceWithBackend<
|
||||
return query;
|
||||
}
|
||||
|
||||
/**
|
||||
* This makes the arrow library loading async.
|
||||
*/
|
||||
async toDataQueryResponse(rsp: any): Promise<DataQueryResponse> {
|
||||
const { resultsToDataFrames } = await import(
|
||||
/* webpackChunkName: "apache-arrow-util" */ '@grafana/data/src/dataframe/ArrowDataFrame'
|
||||
);
|
||||
return { data: resultsToDataFrames(rsp) };
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a GET request to the datasource resource path
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user