Skip to content

Show generic error message for custom purchase logic errors#3130

Closed
rickvdl wants to merge 2 commits intomainfrom
rickvdl/custom-purchase-logic-error-message
Closed

Show generic error message for custom purchase logic errors#3130
rickvdl wants to merge 2 commits intomainfrom
rickvdl/custom-purchase-logic-error-message

Conversation

@rickvdl
Copy link
Member

@rickvdl rickvdl commented Feb 23, 2026

Updates custom PurchaseLogic handling to display a generic error message as a fallback in case no error message is returned by the custom PurchaseLogic.

Related iOS PR: RevenueCat/purchases-ios#6334
Related hybrid-common PR: TODO

Copy link
Contributor

@tonidero tonidero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm usnure if we should do this since it's a bit of a behavior breaking change, and also limits some functionality....Wdyt?

<string name="no_browser_cannot_open_link">No browser installed. Link could not be opened.</string>
<string name="cannot_open_link">Link invalid. Could not be opened.</string>
<string name="external_purchase_error">An error occurred during the purchase. Please try again.</string>
<string name="external_restore_error">An error occurred while restoring purchases. Please try again.</string>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm we might need to localize this in all languages our paywalls are supported I think? This also applies to the strings above TBH :/

val state: StateFlow<PaywallState>
val resourceProvider: ResourceProvider
val actionInProgress: State<Boolean>
val actionError: State<PurchasesError?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the previous actionError now becomes unused? If so we should remove it.

}
is PurchaseLogicResult.Error -> {
result.errorDetails?.let { _actionError.value = it }
_actionErrorMessage.value = resourceProvider.getString(R.string.external_restore_error)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I'm a bit unsure... So a developer can use this to customize the error message displayed right? (not the main intent for this, but still it's possible. The developer needs to create a PurchasesError anyway where they can put their error message. I guess I would only use this generic error message in case the developer didn't provide one?

Otherwise this could also be considered a behavior breaking change.

@rickvdl rickvdl force-pushed the rickvdl/custom-purchase-logic-error-message branch from 5d524d7 to 0a94bc2 Compare February 24, 2026 11:08
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

ErrorDialog(
dismissRequest = viewModel::clearActionError,
error = it.message,
error = error.underlyingErrorMessage ?: error.message,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RevenueCat errors show technical details instead of user message

Medium Severity

The display logic was changed from error.message to error.underlyingErrorMessage ?: error.message. For PurchasesError, message is the user-facing text from the error code (e.g. "Error performing request."), while underlyingErrorMessage holds technical details (e.g. exception messages). RevenueCat errors from the restore/purchase catch blocks now prefer underlyingErrorMessage, so users may see raw technical text instead of the intended user-friendly message.

Fix in Cursor Fix in Web

@rickvdl rickvdl closed this Feb 27, 2026
@rickvdl rickvdl deleted the rickvdl/custom-purchase-logic-error-message branch February 27, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants