Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion web/src/lib/analytics/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,13 @@ async function parseError(response: Response): Promise<{
.json()
.catch(() => null)) as ErrorPayload | null;

const fallbackMessage =
response.status === 404
? "Analytics endpoint not found (404). Deploy the latest API and verify VITE_BACKEND_URL."
: "Analytics request failed";

return {
message: parsed?.error?.message || "Analytics request failed",
message: parsed?.error?.message || fallbackMessage,
Comment on lines +64 to +70
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds new 404-specific fallback messaging but the behavior isn’t covered by tests. Since the web repo already has Vitest unit tests for similar $lib network/client utilities, consider adding a small unit test for parseError (or fetchAnalyticsDashboard) verifying that a 404 with a non-JSON body produces the new fallback message while non-404 statuses keep the existing fallback.

Copilot uses AI. Check for mistakes.
code: parsed?.error?.type,
};
}
Expand Down
Loading