From fd526c542a74dbc947d64c5d7b0494b8a3f6affb Mon Sep 17 00:00:00 2001 From: Jonathan Klee Date: Wed, 12 Oct 2022 15:45:22 +0200 Subject: [PATCH] Do not throw exception Throwing an exception does not really make sense here. Returning an empty list is enough for the caller to understand there is no module found. --- .../java/com/aurora/gplayapi/helpers/PurchaseHelper.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/aurora/gplayapi/helpers/PurchaseHelper.kt b/src/main/java/com/aurora/gplayapi/helpers/PurchaseHelper.kt index ed47ea4..56e7035 100644 --- a/src/main/java/com/aurora/gplayapi/helpers/PurchaseHelper.kt +++ b/src/main/java/com/aurora/gplayapi/helpers/PurchaseHelper.kt @@ -118,7 +118,6 @@ class PurchaseHelper(authData: AuthData) : BaseHelper(authData) { return payload.deliveryResponse } - @Throws(Exception::class) fun getOnDemandModule( packageName: String, splitModule: String, @@ -134,9 +133,9 @@ class PurchaseHelper(authData: AuthData) : BaseHelper(authData) { offerType ) - when (deliveryResponse.status) { - 1 -> return getDownloadsFromDeliveryResponse(packageName, versionCode, deliveryResponse) - else -> throw ApiException.Unknown() + return when (deliveryResponse.status) { + 1 -> getDownloadsFromDeliveryResponse(packageName, versionCode, deliveryResponse) + else -> listOf() } } -- GitLab