purchases-flutter icon indicating copy to clipboard operation
purchases-flutter copied to clipboard

use tryParse in PurchasesErrorHelper to avoid FormatException

Open kbot opened this issue 1 year ago • 0 comments

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)

kbot avatar Sep 10 '24 18:09 kbot