Handle checkout failures without throwing a misleading delivery error - #267
Open
sentry[bot] wants to merge 1 commit into
Open
Handle checkout failures without throwing a misleading delivery error#267sentry[bot] wants to merge 1 commit into
sentry[bot] wants to merge 1 commit into
Conversation
The checkout error paths called processDeliveryItem(), which always threw
BackendAPIException("Failed to init delivery workflow") regardless of the
actual delivery state. Any non-2xx checkout response (e.g. the backend's
HTTP 500 on inventory validation) or network error was therefore reported
to Sentry as a delivery workflow failure.
Delivery processing now runs only after a successful checkout and reports
an error only when it genuinely cannot start. Failed checkouts dismiss the
progress dialog on the UI thread, notify the user, add a breadcrumb with
the real reason (HTTP status or IO error) and finish the transaction with
INTERNAL_ERROR.
Fixes [ANDROID-N5](https://demo.sentry.io/issues/7708304844/)
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #267 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 16 16
Lines 883 900 +17
Branches 67 68 +1
=====================================
- Misses 883 900 +17 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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:
MainFragment.checkout()calledprocessDeliveryItem()only from its failure paths (non-2xx response and network failure), andprocessDeliveryItem()unconditionally threwBackendAPIException("Failed to init delivery workflow")and captured it. So every failed checkout — including the backend's HTTP 500 from inventory validation — was reported to Sentry as a delivery workflow failure that never actually happened, hiding the real error.Solution: Delivery processing now runs only after a successful checkout and processes the checked-out items, reporting an error only when it genuinely cannot be started. Failed checkouts are handled gracefully instead: the progress dialog is dismissed on the UI thread, the user is shown a "Checkout failed" toast, a breadcrumb records the real reason (HTTP status code or IO error message), and the checkout transaction is finished with
INTERNAL_ERROR. Network failures continue to be captured with their actual exception.Fixes ANDROID-N5