Fix checkout error handling: guard processDeliveryItem on success only#228
Open
sentry[bot] wants to merge 1 commit into
Open
Fix checkout error handling: guard processDeliveryItem on success only#228sentry[bot] wants to merge 1 commit into
sentry[bot] wants to merge 1 commit into
Conversation
Fixes ANDROID-HQ - Only call processDeliveryItem when checkout response is successful - Remove processDeliveryItem call from onFailure callback - Remove hardcoded throw from processDeliveryItem; replace with proper span completion logic - On checkout failure, dismiss dialog and finish transaction with INTERNAL_ERROR status without triggering processDeliveryItem
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #228 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 16 16
Lines 875 870 -5
Branches 65 64 -1
=====================================
+ Misses 875 870 -5 ☔ 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.
Summary
Fixes ANDROID-HQ
The Android app was unconditionally calling
processDeliveryItemafter checkout regardless of the HTTP response status. Additionally,processDeliveryItemcontained a hardcodedthrow new BackendAPIException, which caused every checkout attempt to capture an error event in Sentry (15,901 occurrences since March 2026).Root Cause
onResponse, when the checkout HTTP response was not successful (!success), the app still calledprocessDeliveryItem.onFailure,processDeliveryItemwas also called unconditionally.processDeliveryItemitself containedthrow new BackendAPIException("Failed to init delivery workflow")— a hardcoded throw that always triggered, causing the ANDROID-HQ Sentry issue.Changes
processDeliveryItemon successful checkout only: InonResponse, only callprocessDeliveryItemwhenresponse.isSuccessful()is true. On failure, dismiss the dialog and finish the transaction withINTERNAL_ERRORstatus.processDeliveryItemfromonFailure: Network failures should not trigger delivery processing.processDeliveryItem: Replace the unconditionalthrow new BackendAPIExceptionwith proper span completion logic (set status to OK and finish the span).Related
See also the companion Flask backend fix in sentry-demos/empower for the server-side inventory validation errors that return HTTP 500.