Skip to content

CodableStrings.decoding_error: added underlying error information#1668

Merged
NachoSoto merged 1 commit into
mainfrom
codable-strings-better-error
Jun 7, 2022
Merged

CodableStrings.decoding_error: added underlying error information#1668
NachoSoto merged 1 commit into
mainfrom
codable-strings-better-error

Conversation

@NachoSoto

Copy link
Copy Markdown
Contributor

While debugging CustomerInfo decoding errors for example, this is the existing error logged in the console:

ERROR: 😿‼️ Couldn't decode data from json. Error:
There was a problem related to the customer info.

With this change:

ERROR: 😿‼️ Couldn't decode data from json.
Error: There was a problem related to the customer info..
Underlying error: Swift.DecodingError.typeMismatch(Swift.Dictionary<Swift.String, RevenueCat.CustomerInfoResponse.Subscription>, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "subscriber", intValue: nil), CodingKeys(stringValue: "subscriptions", intValue: nil)], debugDescription: "Expected to decode Dictionary<String, Subscription> but found an array instead.", underlyingError: nil))

While debugging `CustomerInfo` decoding errors for example, this is the existing error logged in the console:
```
ERROR: 😿‼️ Couldn't decode data from json. Error:
There was a problem related to the customer info.
```

With this change:
```
ERROR: 😿‼️ Couldn't decode data from json.
Error: There was a problem related to the customer info..
Underlying error: Swift.DecodingError.typeMismatch(Swift.Dictionary<Swift.String, RevenueCat.CustomerInfoResponse.Subscription>, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "subscriber", intValue: nil), CodingKeys(stringValue: "subscriptions", intValue: nil)], debugDescription: "Expected to decode Dictionary<String, Subscription> but found an array instead.", underlyingError: nil))
```
@NachoSoto NachoSoto requested a review from a team June 7, 2022 21:46

@taquitos taquitos 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.

🎈🐐
image

@NachoSoto

Copy link
Copy Markdown
Contributor Author

Flaky tests.
Something I was seeing today, sometimes tests find a pre-existing receipt in Bundle.appStoreReceiptURL. I wonder if we should delete that if it exists at the beginning of every test?

@NachoSoto NachoSoto merged commit ee18269 into main Jun 7, 2022
@NachoSoto NachoSoto deleted the codable-strings-better-error branch June 7, 2022 22:08
@taquitos

taquitos commented Jun 7, 2022

Copy link
Copy Markdown
Contributor

Flaky tests. Something I was seeing today, sometimes tests find a pre-existing receipt in Bundle.appStoreReceiptURL. I wonder if we should delete that if it exists at the beginning of every test?

I think cleaning up any data that could persist between launches makes sense. It's a bummer this doesn't happen all the time, but I'm not shocked.

@NachoSoto

Copy link
Copy Markdown
Contributor Author

#1671

@NachoSoto NachoSoto mentioned this pull request Jun 7, 2022
NachoSoto added a commit that referenced this pull request Jun 7, 2022
_This version supports Xcode 14 beta 1_

* `PurchasesOrchestrator.handleDeferredTransaction`: check `NSError.domain` too (#1665) via NachoSoto (@NachoSoto)
* `PurchasesOrchestrator`: replaced manual `Lock` with `Atomic` (#1664) via NachoSoto (@NachoSoto)
* `CodableStrings.decoding_error`: added underlying error information (#1668) via NachoSoto (@NachoSoto)
* Fixed Xcode 14 compilation: avoid `@available` properties (#1661) via NachoSoto (@NachoSoto)
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