Skip to content

Handle product catalog fetch failures gracefully - #27

Open
sentry[bot] wants to merge 1 commit into
mainfrom
claude/fix-product-catalog-500-handling-k3m9p
Open

sentry[bot] wants to merge 1 commit into
mainfrom
claude/fix-product-catalog-500-handling-k3m9p

Conversation

@sentry

@sentry sentry Bot commented Nov 24, 2026

Copy link
Copy Markdown

This pull request was triggered by a Seer handoff from Sentry.

Root cause

When GET /products fails (the Flask backend intermittently returns HTTP 500 because of a pg_sleep() in its product query), the Flutter catalog screen had no recovery path: the response body was decoded regardless of status code, and the FutureBuilder in product_list.dart responded to snapshot.hasError by throwing a new Exception("Error fetching shop data") from build(). That surfaced as an unhandled fatal exception and broke the catalog screen.

Solution

fetchShopItems() now treats a non-200 response as a failure with a descriptive message and reports the failure to Sentry as a handled exception (with stack trace) before rethrowing. The FutureBuilder renders a friendly error state with a "Try again" button instead of throwing, and the fetch logic was extracted into _loadShopItems() so the retry re-runs the request and rebuilds the catalog. Successful loads behave exactly as before, including TTFD reporting.

Fixes FLUTTER-33

The product list threw an unhandled fatal exception whenever the
/products request failed (e.g. HTTP 500 from the backend), crashing the
catalog screen. Non-200 responses are now surfaced as a handled error
reported to Sentry, and the FutureBuilder renders a recoverable error
state with a retry action instead of rethrowing.

Fixes [FLUTTER-33](https://demo.sentry.io/issues/7301731393/)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant