diff --git a/app/vmui/packages/vmui/src/hooks/useFetchQuery.ts b/app/vmui/packages/vmui/src/hooks/useFetchQuery.ts index a9e3cc74c..980527713 100644 --- a/app/vmui/packages/vmui/src/hooks/useFetchQuery.ts +++ b/app/vmui/packages/vmui/src/hooks/useFetchQuery.ts @@ -136,7 +136,11 @@ export const useFetchQuery = ({ totalLength += resp.data.result.length; } else { tempData.push({ metric: {}, values: [], group: counter } as MetricBase); - setQueryErrors(prev => [...prev, `${resp.errorType}\r\n${resp?.error}`]); + const errorType = resp.errorType || ErrorTypes.unknownType; + const errorMessage = resp?.error || resp?.message || "see console for more details"; + const error = [errorType, errorMessage].join(",\r\n"); + setQueryErrors(prev => [...prev, `${error}`]); + console.error(`Fetch query error: ${errorType}`, resp); } counter++; } diff --git a/app/vmui/packages/vmui/src/types/index.ts b/app/vmui/packages/vmui/src/types/index.ts index c04aea5bd..f4bd75873 100644 --- a/app/vmui/packages/vmui/src/types/index.ts +++ b/app/vmui/packages/vmui/src/types/index.ts @@ -47,7 +47,8 @@ export enum ErrorTypes { traceNotFound = "Not found the tracing information", emptyTitle = "Please enter title", positiveNumber = "Please enter positive number", - validStep = "Please enter a valid step" + validStep = "Please enter a valid step", + unknownType = "Unknown server response format: must have 'errorType'", } export interface PanelSettings {