mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-01-10 15:14:09 +00:00
VMUI: Handle unknown query error response type (#5451)
* VMUI: Handle unknown query error response type
* vmui: add error text for unknown error type
* Simplify nested `if`s for unknown error
Accepting @Loori-R's suggestion
Co-authored-by: Yury Molodov <yurymolodov@gmail.com>
---------
Co-authored-by: Yury Moladau <yurymolodov@gmail.com>
(cherry picked from commit cd277e3f84
)
This commit is contained in:
parent
c86e0fdc24
commit
44c113f829
2 changed files with 7 additions and 2 deletions
|
@ -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++;
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue