Skip to content

Instantly share code, notes, and snippets.

@SergeiMikhailovskii
Created March 23, 2024 17:55
Show Gist options
  • Save SergeiMikhailovskii/9ebb55361f9f4aa25eff826b26fec20f to your computer and use it in GitHub Desktop.
Save SergeiMikhailovskii/9ebb55361f9f4aa25eff826b26fec20f to your computer and use it in GitHub Desktop.
internal class RuStoreExceptionMapper {
operator fun invoke(throwable: RuStoreException) = when (throwable) {
is RuStoreNotInstalledException -> ReviewCode.STORE_NOT_FOUND
is RuStoreOutdatedException -> ReviewCode.STORE_OUTDATED
is RuStoreUserBannedException -> ReviewCode.USER_BANNED
is RuStoreApplicationBannedException -> ReviewCode.APP_BANNED
is RuStoreRequestLimitReached -> ReviewCode.REQUEST_LIMIT_REACHED
is RuStoreReviewExists -> ReviewCode.REVIEW_EXISTS
is RuStoreInvalidReviewInfo -> ReviewCode.INVALID_REVIEW_INFO
else -> throw throwable
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment