Panel: Show multiple errors info in the inspector (#64340)

This commit is contained in:
Andres Martinez Gotor
2023-03-08 16:11:38 +01:00
committed by GitHub
parent 3292cb86ae
commit 15aae5e8a9
10 changed files with 207 additions and 24 deletions

View File

@@ -54,6 +54,7 @@ const resWithError = {
results: {
A: {
error: 'Hello Error',
status: 400,
frames: [
{
schema: {
@@ -354,12 +355,14 @@ describe('Query Response parser', () => {
{
"message": "Hello Error",
"refId": "A",
"status": 400,
}
`);
expect(res.errors).toEqual([
{
message: 'Hello Error',
refId: 'A',
status: 400,
},
]);

View File

@@ -33,6 +33,7 @@ export interface DataResponse {
error?: string;
refId?: string;
frames?: DataFrameJSON[];
status?: number;
// Legacy TSDB format...
series?: TimeSeries[];
@@ -86,12 +87,13 @@ export function toDataQueryResponse(
rsp.error = {
refId: dr.refId,
message: dr.error,
status: dr.status,
};
}
if (rsp.errors) {
rsp.errors.push({ refId: dr.refId, message: dr.error });
rsp.errors.push({ refId: dr.refId, message: dr.error, status: dr.status });
} else {
rsp.errors = [{ refId: dr.refId, message: dr.error }];
rsp.errors = [{ refId: dr.refId, message: dr.error, status: dr.status }];
}
rsp.state = LoadingState.Error;
}