Repository navigation
Handle product catalog fetch failures gracefully - #27
Open
sentry[bot] wants to merge 1 commit into
Open
sentry[bot] wants to merge 1 commit into
sentry[bot] wants to merge 1 commit into
Conversation
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/)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request was triggered by a Seer handoff from Sentry.
Root cause
When
GET /productsfails (the Flask backend intermittently returns HTTP 500 because of apg_sleep()in its product query), the Flutter catalog screen had no recovery path: the response body was decoded regardless of status code, and theFutureBuilderinproduct_list.dartresponded tosnapshot.hasErrorby throwing a newException("Error fetching shop data")frombuild(). 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. TheFutureBuilderrenders 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