diff --git a/public/app/features/dashboard/dashgrid/PanelChrome.tsx b/public/app/features/dashboard/dashgrid/PanelChrome.tsx index 9a725264c10..d08f298f7ad 100644 --- a/public/app/features/dashboard/dashgrid/PanelChrome.tsx +++ b/public/app/features/dashboard/dashgrid/PanelChrome.tsx @@ -99,15 +99,9 @@ export class PanelChrome extends PureComponent { if (data.state === LoadingState.Error) { const { error } = data; if (error) { - let message = 'Query error'; - if (error.message) { - message = error.message; - } else if (error.data && error.data.message) { - message = error.data.message; - } else if (error.data && error.data.error) { - message = error.data.error; - } else if (error.status) { - message = `Query error: ${error.status} ${error.statusText}`; + let message = error.message; + if (!message) { + message = 'Query error'; } if (this.state.errorMessage !== message) { diff --git a/public/app/features/dashboard/state/PanelQueryRunner.ts b/public/app/features/dashboard/state/PanelQueryRunner.ts index 16fbc7b0f67..8f98d25c849 100644 --- a/public/app/features/dashboard/state/PanelQueryRunner.ts +++ b/public/app/features/dashboard/state/PanelQueryRunner.ts @@ -20,10 +20,10 @@ import cloneDeep from 'lodash/cloneDeep'; import kbn from 'app/core/utils/kbn'; -export interface QueryRunnerOptions { - ds?: DataSourceApi; // if they already have the datasource, don't look it up +export interface QueryRunnerOptions { + ds?: DataSourceApi; // if they already have the datasource, don't look it up datasource: string | null; - queries: DataQuery[]; + queries: TQuery[]; panelId: number; dashboardId?: number; timezone?: string; @@ -174,7 +174,17 @@ export class PanelQueryRunner { } catch (err) { const error = err as DataQueryError; if (!error.message) { - err.message = 'Query Error'; + let message = 'Query error'; + if (error.message) { + message = error.message; + } else if (error.data && error.data.message) { + message = error.data.message; + } else if (error.data && error.data.error) { + message = error.data.error; + } else if (error.status) { + message = `Query error: ${error.status} ${error.statusText}`; + } + error.message = message; } this.data = {