Skip to content

Improve error message when backend returns internal error code#1038

Merged
tonidero merged 1 commit into
mainfrom
improve-error-message
May 31, 2023
Merged

Improve error message when backend returns internal error code#1038
tonidero merged 1 commit into
mainfrom
improve-error-message

Conversation

@tonidero

Copy link
Copy Markdown
Contributor

Description

From the offline entitlements bugbash, @NachoSoto noticed that the error messages can be very confusing upon receiving a 7110 backend error code (internal server error). This just modifies the error message slightly so it's not as confusing.

NetworkError(10, "Error performing request."),
InvalidCredentialsError(11, "There was a credentials issue. Check the underlying error for more details."),
UnexpectedBackendResponseError(12, "Received malformed response from the backend."),
UnexpectedBackendResponseError(12, "Received unexpected response from the backend."),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is only used when the backend returns a 7110 error code (Internal server error). I would expect that on 5xx error codes, the backend wouldn't really return anything in the body though. In which case, UnknownBackendError, There was an unknown backend error. is used instead.

In any case, the response from the backend in this case it's not actually malformed, so changed it to unexpected instead.

@tonidero tonidero marked this pull request as ready for review May 31, 2023 10:17
@tonidero tonidero requested a review from a team May 31, 2023 10:17
@codecov

codecov Bot commented May 31, 2023

Copy link
Copy Markdown

Codecov Report

Merging #1038 (664be1c) into main (e5d9ac8) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1038   +/-   ##
=======================================
  Coverage   85.54%   85.54%           
=======================================
  Files         175      175           
  Lines        6123     6123           
  Branches      857      857           
=======================================
  Hits         5238     5238           
  Misses        550      550           
  Partials      335      335           
Impacted Files Coverage Δ
...c/src/main/java/com/revenuecat/purchases/errors.kt 100.00% <100.00%> (ø)

@NachoSoto NachoSoto left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This makes sense 👍🏻

@tonidero tonidero merged commit 9145719 into main May 31, 2023
@tonidero tonidero deleted the improve-error-message branch May 31, 2023 15:01
tonidero added a commit that referenced this pull request Jun 1, 2023
**This is an automatic release.**

### New Features
* Offline entitlements support (#1030) via Toni Rico (@tonidero)
### Bugfixes
* Fix billing connection error when querying purchases early in the
process lifetime (#1032) via Toni Rico (@tonidero)
### Performance Improvements
* Perform product entitlement mapping request after more critical
requests (#1017) via Toni Rico (@tonidero)
### Dependency Updates
* Bump fastlane from 2.212.2 to 2.213.0 (#1024) via dependabot[bot]
(@dependabot[bot])
### Other Changes
* Get offerings response from disk cache if available (#1029) via Toni
Rico (@tonidero)
* Improve offline entitlements logs to mention limitations of this mode
(#1039) via Toni Rico (@tonidero)
* Improve error message when backend returns internal error code (#1038)
via Toni Rico (@tonidero)
* PurchaseTester: Add new UI to configure internal proxy behavior
(#1016) via Toni Rico (@tonidero)
* Updated readme to include links to migration guides (#1021) via Marcos
Castany (@mcastany)
* Store offerings response in SharedPreferences (#1028) via Toni Rico
(@tonidero)
* Refactor offerings code out of Purchases (#1027) via Toni Rico
(@tonidero)

---------

Co-authored-by: revenuecat-ops <ops@revenuecat.com>
Co-authored-by: Toni Rico <antonio.rico.diez@revenuecat.com>
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.

2 participants