Hi, folks. I've just wrapped android billing into ...
# coroutines
a
Hi, folks. I've just wrapped android billing into coroutines https://github.com/lion4ik/BillingCoroutines . I would appreciate your code review. Feel free to come up with ideas and issues. 🙂
b
Using a
sealed class
for your various
BillingException
types seem like a win. It in general makes your exceptions nicer to consume via
try..catch
or
is
For example, using
BillingServiceDisconnectedException
that extends
sealed class BillingException
inside your
suspend fun connectService()
instead of
BillingException(BillingClient.BillingResponse.SERVICE_DISCONNECTED)
https://github.com/lion4ik/BillingCoroutines/blob/c6351b72019e80a67c8665d895752ec652699c34/billing/src/main/java/com/github/lion4ik/billing/BillingManager.kt#L54
It looks like you already have made the various exceptions, but not using your
BillingExceptionFactory
in your
suspend fun connectService()
I would definitely recommend making
BillingException
a
sealed class
instead of just an
open class
d
Also move all those exceptions to the same file. They're all one liners and they're all exceptions.
👍🏾 1
a
thanks @bdawg.io! Make sense, I will definitely fix it!