diff --git a/frontend/src/api/ErrorResponseHandler.ts b/frontend/src/api/ErrorResponseHandler.ts index 3f28ff418d..027418ec84 100644 --- a/frontend/src/api/ErrorResponseHandler.ts +++ b/frontend/src/api/ErrorResponseHandler.ts @@ -30,7 +30,8 @@ export function ErrorResponseHandler(error: AxiosError): ErrorResponse { statusCode, payload: null, error: errorMessage, - message: null, + message: (response.data as any)?.status, + body: JSON.stringify((response.data as any).data), }; } diff --git a/frontend/src/container/GridCardLayout/GridCard/index.tsx b/frontend/src/container/GridCardLayout/GridCard/index.tsx index 1633f0b947..d81e518222 100644 --- a/frontend/src/container/GridCardLayout/GridCard/index.tsx +++ b/frontend/src/container/GridCardLayout/GridCard/index.tsx @@ -152,6 +152,16 @@ function GridCardGraph({ widget?.panelTypes, widget.timePreferance, ], + retry(failureCount, error): boolean { + if ( + String(error).includes('status: error') && + String(error).includes('i/o timeout') + ) { + return false; + } + + return failureCount < 2; + }, keepPreviousData: true, enabled: queryEnabledCondition, refetchOnMount: false, diff --git a/frontend/src/lib/dashboard/getQueryResults.ts b/frontend/src/lib/dashboard/getQueryResults.ts index 177ae9311b..0290a574cd 100644 --- a/frontend/src/lib/dashboard/getQueryResults.ts +++ b/frontend/src/lib/dashboard/getQueryResults.ts @@ -34,7 +34,7 @@ export async function GetMetricQueryRange( if (response.statusCode >= 400) { throw new Error( - `API responded with ${response.statusCode} - ${response.error}`, + `API responded with ${response.statusCode} - ${response.error} status: ${response.message}, errors: ${response?.body}`, ); } diff --git a/frontend/src/types/api/index.ts b/frontend/src/types/api/index.ts index 49fdb21a4e..b7a0ed57e4 100644 --- a/frontend/src/types/api/index.ts +++ b/frontend/src/types/api/index.ts @@ -6,7 +6,8 @@ export interface ErrorResponse { statusCode: ErrorStatusCode; payload: null; error: string; - message: null; + message: string | null; + body?: string | null; } export interface SuccessResponse {