Skip to content

Commit

Permalink
feat: handles error case for purchase products api response
Browse files Browse the repository at this point in the history
  • Loading branch information
cb-haripriyan committed Feb 20, 2023
1 parent 0ed6109 commit 03a4e7e
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.chargebee.android

import com.chargebee.android.billingservice.CBCallback
import com.chargebee.android.billingservice.CBPurchase
import com.chargebee.android.billingservice.GPErrorCode
import com.chargebee.android.exceptions.CBException
import com.chargebee.android.exceptions.CBProductIDResult
import com.chargebee.android.models.CBProduct
Expand Down Expand Up @@ -81,7 +82,11 @@ class ChargebeeReactNativeModule internal constructor(context: ReactApplicationC
promise.reject(error.message, error)
}
})
} else {
val productNotAvailable = CBException(ErrorDetail(GPErrorCode.ProductUnavailable.errorMsg))
promise.reject(productNotAvailable.message, productNotAvailable)
}

}
override fun onError(error: CBException) {
promise.reject(error.message, error)
Expand Down

0 comments on commit 03a4e7e

Please sign in to comment.