diff --git a/src/components/DotIndicatorMessage.tsx b/src/components/DotIndicatorMessage.tsx
index 65afe8c7e4eb..2787804c5f76 100644
--- a/src/components/DotIndicatorMessage.tsx
+++ b/src/components/DotIndicatorMessage.tsx
@@ -84,9 +84,9 @@ function DotIndicatorMessage({messages = {}, style, type, textStyles}: DotIndica
key={i}
style={styles.offlineFeedback.text}
>
- {Localize.translateLocal('iou.error.receiptFailureMessage')}
- {Localize.translateLocal('iou.error.saveFileMessage')}
- {Localize.translateLocal('iou.error.loseFileMessage')}
+ {Localize.translateLocal('iou.error.receiptFailureMessage')}
+ {Localize.translateLocal('iou.error.saveFileMessage')}
+ {Localize.translateLocal('iou.error.loseFileMessage')}
) : (
diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js
index d43fefca20bc..24ae35bdb0cd 100644
--- a/src/libs/actions/IOU.js
+++ b/src/libs/actions/IOU.js
@@ -290,6 +290,20 @@ function resetMoneyRequestInfo(id = '') {
});
}
+/**
+ * Helper function to get the receipt error for money requests, or the generic error if there's no receipt
+ *
+ * @param {Object} receipt
+ * @param {String} filename
+ * @param {Boolean} [isScanRequest]
+ * @returns {Object}
+ */
+function getReceiptError(receipt, filename, isScanRequest = true) {
+ return _.isEmpty(receipt) || !isScanRequest
+ ? ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage')
+ : ErrorUtils.getMicroSecondOnyxErrorObject({error: CONST.IOU.RECEIPT_ERROR, source: receipt.source, filename});
+}
+
function buildOnyxDataForMoneyRequest(
chatReport,
iouReport,
@@ -304,6 +318,7 @@ function buildOnyxDataForMoneyRequest(
isNewChatReport,
isNewIOUReport,
) {
+ const isScanRequest = TransactionUtils.isScanRequest(transaction);
const optimisticData = [
{
// Use SET for new reports because it doesn't exist yet, is faster and we need the data to be available when we navigate to the chat page
@@ -507,7 +522,7 @@ function buildOnyxDataForMoneyRequest(
...(isNewChatReport
? {
[chatCreatedAction.reportActionID]: {
- errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'),
+ errors: getReceiptError(transaction.receipt, transaction.filename || transaction.receipt.filename, isScanRequest),
},
[reportPreviewAction.reportActionID]: {
errors: ErrorUtils.getMicroSecondOnyxError(null),
@@ -516,7 +531,7 @@ function buildOnyxDataForMoneyRequest(
: {
[reportPreviewAction.reportActionID]: {
created: reportPreviewAction.created,
- errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'),
+ errors: getReceiptError(transaction.receipt, transaction.filename || transaction.receipt.filename, isScanRequest),
},
}),
},
@@ -528,7 +543,7 @@ function buildOnyxDataForMoneyRequest(
...(isNewIOUReport
? {
[iouCreatedAction.reportActionID]: {
- errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'),
+ errors: getReceiptError(transaction.receipt, transaction.filename || transaction.receipt.filename, isScanRequest),
},
[iouAction.reportActionID]: {
errors: ErrorUtils.getMicroSecondOnyxError(null),
@@ -536,7 +551,7 @@ function buildOnyxDataForMoneyRequest(
}
: {
[iouAction.reportActionID]: {
- errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'),
+ errors: getReceiptError(transaction.receipt, transaction.filename || transaction.receipt.filename, isScanRequest),
},
}),
},
@@ -1683,7 +1698,7 @@ function startSplitBill(participants, currentUserLogin, currentUserAccountID, co
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${splitChatReport.reportID}`,
value: {
[splitIOUReportAction.reportActionID]: {
- errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'),
+ errors: getReceiptError(receipt, filename),
},
},
});
@@ -1706,7 +1721,7 @@ function startSplitBill(participants, currentUserLogin, currentUserAccountID, co
errors: ErrorUtils.getMicroSecondOnyxError('report.genericCreateReportFailureMessage'),
},
[splitIOUReportAction.reportActionID]: {
- errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'),
+ errors: getReceiptError(receipt, filename),
},
},
},