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>
This commit is contained in:
parent
0a6a2e455d
commit
cd277e3f84
2 changed files with 7 additions and 2 deletions
|
@ -136,7 +136,11 @@ export const useFetchQuery = ({
|
||||||
totalLength += resp.data.result.length;
|
totalLength += resp.data.result.length;
|
||||||
} else {
|
} else {
|
||||||
tempData.push({ metric: {}, values: [], group: counter } as MetricBase);
|
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++;
|
counter++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,8 @@ export enum ErrorTypes {
|
||||||
traceNotFound = "Not found the tracing information",
|
traceNotFound = "Not found the tracing information",
|
||||||
emptyTitle = "Please enter title",
|
emptyTitle = "Please enter title",
|
||||||
positiveNumber = "Please enter positive number",
|
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 {
|
export interface PanelSettings {
|
||||||
|
|
Loading…
Reference in a new issue