Skip to content

ErrorCode.unknownBackendError: include original error code#2032

Merged
NachoSoto merged 1 commit into
mainfrom
track-original-backend-error-code
Nov 11, 2022
Merged

ErrorCode.unknownBackendError: include original error code#2032
NachoSoto merged 1 commit into
mainfrom
track-original-backend-error-code

Conversation

@NachoSoto

Copy link
Copy Markdown
Contributor

Currently we only include the message and not the error code. So when these unknown errors are returned, unless the message is clear, we might not known which code the backend actually sent.
Example:

There was an unknown backend error. The purchased product was missing in the receipt. This is typically due to a bug in StoreKit.

In this case it's clear, but nowhere in the logs we can find the error code.

This adds the error code to those messages (only when the code is unknown), as well as to userInfo.

Examples from the tests

Before:

There was an unknown backend error. This is a future unknown error

After:

There was an unknown backend error. This is a future unknown error (1234)

Before:

😿‼️ There was an unknown backend error. Page not found

After:

😿‼️ There was an unknown backend error. Page not found (6000)

@NachoSoto NachoSoto requested a review from a team November 7, 2022 22:04
NachoSoto added a commit that referenced this pull request Nov 7, 2022
See https://github.com/RevenueCat/khepri/pull/4716
This makes that error `ErrorCode.invalidReceiptError` instead of `.unknownBackendError`.

I've also added #2032 to improve error messages when these errors are unknown in the future.
NachoSoto added a commit that referenced this pull request Nov 8, 2022
See https://github.com/RevenueCat/khepri/pull/4716
This makes that error `ErrorCode.invalidReceiptError` instead of
`.unknownBackendError`.

I've also added #2032 to improve error messages when these errors are
unknown in the future.
@NachoSoto NachoSoto force-pushed the track-original-backend-error-code branch from 0787b8a to 69ee7fd Compare November 9, 2022 00:22
Currently we only include the message and not the error code. So when these unknown errors are returned, unless the message is clear, we might not known which code the backend actually sent.
Example:
> There was an unknown backend error. The purchased product was missing in the receipt. This is typically due to a bug in StoreKit.

In this case it's clear, but nowhere in the logs we can find the error code.

This adds the error code to those messages (only when the code is unknown), as well as to `userInfo`.

### Examples from the tests

#### Before:
> There was an unknown backend error. This is a future unknown error
#### After:
> There was an unknown backend error. This is a future unknown error (1234)

#### Before:
> 😿‼️ There was an unknown backend error. Page not found
#### After:
> 😿‼️ There was an unknown backend error. Page not found (6000)
@NachoSoto NachoSoto force-pushed the track-original-backend-error-code branch from 69ee7fd to e74d86c Compare November 9, 2022 14:41

@vegaro vegaro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is going to be very useful

@NachoSoto NachoSoto merged commit 74c2993 into main Nov 11, 2022
@NachoSoto NachoSoto deleted the track-original-backend-error-code branch November 11, 2022 16:02
NachoSoto pushed a commit that referenced this pull request Nov 18, 2022
**This is an automatic release.**

### Bugfixes
* `StoreKit 2`: don't finish transactions in observer mode (#2053) via
NachoSoto (@NachoSoto)
### Other Changes
* `CircleCI`: added ability to create a release manually (#2067) via
NachoSoto (@NachoSoto)
* Changelog: Fix links to V4 API Migration guide (#2051) via Kevin
Quisquater (@KevinQuisquater)
* `HTTPClient`: added log for failed requests (#2048) via NachoSoto
(@NachoSoto)
* `ErrorResponse.asBackendError`: serialize attribute errors as
`NSDictionary` (#2034) via NachoSoto (@NachoSoto)
* `ErrorCode.unknownBackendError`: include original error code (#2032)
via NachoSoto (@NachoSoto)
* `CI`: fixed `push-pods` job (#2045) via NachoSoto (@NachoSoto)
* `PostReceiptDataOperation`: log Apple error when purchase equals
expiration date (#2038) via NachoSoto (@NachoSoto)
* Update Fastlane plugin (#2041) via Cesar de la Vega (@vegaro)
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