mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Dashboards: Show error when data source is missing (#60099)
Return caught exceptions to panel as error state
This commit is contained in:
parent
666f69ca14
commit
9a41277ecd
@ -6,7 +6,7 @@ import { DataQueryError } from '@grafana/data';
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export function toDataQueryError(err: DataQueryError | string | Object): DataQueryError {
|
||||
export function toDataQueryError(err: DataQueryError | string | unknown): DataQueryError {
|
||||
const error = (err || {}) as DataQueryError;
|
||||
|
||||
if (!error.message) {
|
||||
|
@ -25,7 +25,7 @@ import {
|
||||
toDataFrame,
|
||||
transformDataFrame,
|
||||
} from '@grafana/data';
|
||||
import { getTemplateSrv } from '@grafana/runtime';
|
||||
import { getTemplateSrv, toDataQueryError } from '@grafana/runtime';
|
||||
import { ExpressionDatasourceRef } from '@grafana/runtime/src/utils/DataSourceWithBackend';
|
||||
import { StreamingDataFrame } from 'app/features/live/data/StreamingDataFrame';
|
||||
import { isStreamingDataFrame } from 'app/features/live/data/utils';
|
||||
@ -276,7 +276,15 @@ export class PanelQueryRunner {
|
||||
|
||||
this.pipeToSubject(runRequest(ds, request), panelId);
|
||||
} catch (err) {
|
||||
console.error('PanelQueryRunner Error', err);
|
||||
this.pipeToSubject(
|
||||
of({
|
||||
state: LoadingState.Error,
|
||||
error: toDataQueryError(err),
|
||||
series: [],
|
||||
timeRange: request.range,
|
||||
}),
|
||||
panelId
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user