Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: error codes mismap android #85

Merged
merged 2 commits into from
Jul 29, 2021
Merged

Conversation

aboedo
Copy link
Member

@aboedo aboedo commented Jul 29, 2021

Addresses RevenueCat/purchases-flutter#222

We have a bug in the code that maps PurchasesErrorCode -> ErrorContainer -> Map.
We're using ordinal to find the value of the error code enum, however, since there's no value for code 13, this maps the wrong error code for all errors after 13.

Fixed by replacing usage of ordinal with .code.

@aboedo aboedo self-assigned this Jul 29, 2021
@@ -23,4 +25,14 @@ internal class MappersHelpersTests {
assertThat(date3?.toMillis()).isEqualTo(649382400000L)
}

@Test
fun `purchasesErrors are mapped correctly`() {
Copy link
Member Author

Choose a reason for hiding this comment

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

confirmed that this test fails on develop

message,
mapOf(
"code" to code.ordinal,
Copy link
Contributor

Choose a reason for hiding this comment

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

great find :)

Copy link
Contributor

@beylmk beylmk left a comment

Choose a reason for hiding this comment

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

🔢

@aboedo aboedo merged commit 7d33d82 into develop Jul 29, 2021
@aboedo aboedo deleted the fix/error_codes_mismap_android branch July 29, 2021 17:42
@aboedo aboedo mentioned this pull request Jul 29, 2021
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