Skip to content

Handle checkout failures without throwing a misleading delivery error - #267

Open
sentry[bot] wants to merge 1 commit into
mainfrom
claude/fix-checkout-delivery-error-handling
Open

Handle checkout failures without throwing a misleading delivery error#267
sentry[bot] wants to merge 1 commit into
mainfrom
claude/fix-checkout-delivery-error-handling

Conversation

@sentry

@sentry sentry Bot commented Sep 3, 2026

Copy link
Copy Markdown

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

Root cause: MainFragment.checkout() called processDeliveryItem() only from its failure paths (non-2xx response and network failure), and processDeliveryItem() unconditionally threw BackendAPIException("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

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/)
@sentry
sentry Bot requested a review from sdzhong as a code owner September 3, 2026 12:28
@sentry

sentry Bot commented Sep 3, 2026

Copy link
Copy Markdown
Author

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
Android com.example.vu.android 24.12.26 (241226) release
Android com.example.vu.android 24.12.26 (241226) debug
Android com.example.vu.android 24.12.26 (241226) release

⚙️ android Build Distribution Settings

@codecov

codecov Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (21c77a4) to head (c54efe7).

Files with missing lines Patch % Lines
.../example/vu/android/empowerplant/MainFragment.java 0.00% 30 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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