diff --git a/fe/src/api/index.ts b/fe/src/api/index.ts index 40a40396..636fc782 100644 --- a/fe/src/api/index.ts +++ b/fe/src/api/index.ts @@ -15,8 +15,8 @@ export class ApiResponseError extends Error { } } export class FetchResponseError extends Error { - public constructor(public readonly response: Response) { - super(JSON.stringify(response)); + public constructor(public readonly bodyText: string) { + super(bodyText); } } // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents @@ -40,10 +40,11 @@ export const queryFunction = (endpoint: string, queryPar { headers: { Accept: 'application/json' }, signal: queryContext.signal } ); const json = await response.json() as TResponse; - if (!response.ok) - throw new FetchResponseError(response); if (isApiError(json)) throw new ApiResponseError(json.errorCode, json.errorInfo); + const response2 = response.clone(); + if (!response.ok) + throw new FetchResponseError(await response2.text()); return json; } finally { diff --git a/fe/src/components/placeholders/PlaceholderError.vue b/fe/src/components/placeholders/PlaceholderError.vue index 6235cce0..ec051d6b 100644 --- a/fe/src/components/placeholders/PlaceholderError.vue +++ b/fe/src/components/placeholders/PlaceholderError.vue @@ -1,23 +1,23 @@