Skip to content

Commit 46f77fe

Browse files
Fix: Surface specific payment error from backend instead of generic fallback
When a payment fails (e.g., report exceeds $20,000 reimbursement limit), the backend sends a specific error message via Onyx. However, the client's failureData also sets a generic "Unexpected error. Please try again later." on the same reportAction. After Onyx deep-merges both errors, getLatestErrorMessageField() picks whichever has the latest timestamp key. By giving the client-side fallback error a timestamp of 0, backend errors (with real timestamps) always take precedence. The fallback still displays for network failures when no backend error is available. Fixed Issues: Expensify/Expensify#610370 Co-authored-by: Lydia Barclay <lydiabarclay@users.noreply.github.com>
1 parent 6463086 commit 46f77fe

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/libs/actions/IOU/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9513,7 +9513,7 @@ function getPayMoneyRequestParams({
95139513
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport?.reportID}`,
95149514
value: {
95159515
[optimisticIOUReportAction.reportActionID]: {
9516-
errors: getMicroSecondOnyxErrorWithTranslationKey('iou.error.other'),
9516+
errors: getMicroSecondOnyxErrorWithTranslationKey('iou.error.other', 0),
95179517
},
95189518
},
95199519
},

0 commit comments

Comments
 (0)