Skip to content

use tryParse in PurchasesErrorHelper to avoid FormatException#1160

Open
kbot wants to merge 1 commit intoRevenueCat:mainfrom
kbot:main
Open

use tryParse in PurchasesErrorHelper to avoid FormatException#1160
kbot wants to merge 1 commit intoRevenueCat:mainfrom
kbot:main

Conversation

@kbot
Copy link

@kbot kbot commented Sep 10, 2024

In some cases using PurchasesErrorHelper in a catch block will result in an uncaught FormatException when code is not a valid Int. This causes additional boilerplate in client applications.

Example error observed in production:

Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: FormatException: Invalid radix-10 number (at character 1)
error
^

       at int.parse(dart:core)
       at PurchasesErrorHelper.getErrorCode(errors.dart:146)

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