diff --git a/frontend/src/api.ts b/frontend/src/api.ts index 6404c97..9d1bd01 100644 --- a/frontend/src/api.ts +++ b/frontend/src/api.ts @@ -78,7 +78,13 @@ export class ForbiddenError extends ApiError { async function handleResponse(response: Response): Promise { if (!response.ok) { const error = await response.json().catch(() => ({ detail: 'Unknown error' })); - const message = error.detail || `HTTP ${response.status}`; + // Handle detail as string or object (backend may return structured errors) + let message: string; + if (typeof error.detail === 'object') { + message = JSON.stringify(error.detail); + } else { + message = error.detail || `HTTP ${response.status}`; + } if (response.status === 401) { throw new UnauthorizedError(message);