diff --git a/public/app/features/dashboard/panel_editor/QueryEditorRow.test.ts b/public/app/features/dashboard/panel_editor/QueryEditorRow.test.ts index 886fe081f5f..b0d2c1a661a 100644 --- a/public/app/features/dashboard/panel_editor/QueryEditorRow.test.ts +++ b/public/app/features/dashboard/panel_editor/QueryEditorRow.test.ts @@ -43,4 +43,17 @@ describe('filterPanelDataToQuery', () => { expect(panelData?.series[0].refId).toBe('B'); expect(panelData?.error!.refId).toBe('B'); }); + + it('should include errors when missing data', () => { + const withError = ({ + series: [], + error: { + message: 'Error!!', + }, + } as unknown) as PanelData; + + const panelData = filterPanelDataToQuery(withError, 'B'); + expect(panelData.state).toBe(LoadingState.Error); + expect(panelData.error).toBe(withError.error); + }); }); diff --git a/public/app/features/dashboard/panel_editor/QueryEditorRow.tsx b/public/app/features/dashboard/panel_editor/QueryEditorRow.tsx index a3816754781..55187db555d 100644 --- a/public/app/features/dashboard/panel_editor/QueryEditorRow.tsx +++ b/public/app/features/dashboard/panel_editor/QueryEditorRow.tsx @@ -335,6 +335,13 @@ export function filterPanelDataToQuery(data: PanelData, refId: string): PanelDat // No matching series if (!series.length) { + // If there was an error with no data, pass it to the QueryEditors + if (data.error && !data.series.length) { + return { + ...data, + state: LoadingState.Error, + }; + } return undefined; }