Solved

Handling errors in the Unity SDK

  • 22 August 2022
  • 2 replies
  • 108 views

Badge +3

Is there a list of all the error code number? Ideally we could rely on an enum to decide what message to display or if we want to attempt a retry, but there is a code number in the SDK’s error that could be the next best thing:

We could use that, but we can’t seem to be able to find a comprehensive list of all the errors with their codes, only this list of strings. Where can we find such a list?

 

(We’re using RevenueCat SDK 4.0.0 and Unity 2021.3.8)

icon

Best answer by Cesar 22 August 2022, 16:52

View original

2 replies

Userlevel 3
Badge +3

Hi @Gabriel_Ulu , there’s currently not an enum with the corresponding errors, which we know is not ideal because it makes handling errors very complex. We have plans to add the enum you’re mentioning, it’s definitely in our backlog. We just recently added it to our Flutter SDK, and we have to add it to the other SDKs, like the Unity one. 

On the meantime, if you want to build something yourself, the list of errors can be found in the Android SDK (https://github.com/RevenueCat/purchases-android/blob/main/public/src/main/java/com/revenuecat/purchases/errors.kt#L24) and iOS SDK (https://github.com/RevenueCat/purchases-ios/blob/main/Sources/Error%20Handling/ErrorCode.swift#L24). The error codes you get in the Unity will match those.

In case you want to check out what we did in Flutter, here’s the code https://github.com/RevenueCat/purchases-flutter/blob/main/lib/errors.dart.

By the way, we accept PRs, so if you end up building something yourself, we will be more than happy that check it out and approve it.

 

Sorry again for not having this feature, we know it’s important.

Badge +3

Thanks! This should be enough fo us.

Reply