From b79d96776c8ec053310c90649aacf559bcc34b17 Mon Sep 17 00:00:00 2001 From: omerhabib26 Date: Wed, 21 Feb 2024 01:34:42 +0500 Subject: [PATCH] fix: added ErrorMessage type for `sku` --- .../java/org/edx/mobile/util/TextUtils.java | 29 ++++++------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/OpenEdXMobile/src/main/java/org/edx/mobile/util/TextUtils.java b/OpenEdXMobile/src/main/java/org/edx/mobile/util/TextUtils.java index afd6e5b0b4..adb3c6f6f7 100644 --- a/OpenEdXMobile/src/main/java/org/edx/mobile/util/TextUtils.java +++ b/OpenEdXMobile/src/main/java/org/edx/mobile/util/TextUtils.java @@ -207,26 +207,15 @@ public static StringBuilder getFormattedErrorMessage(int requestType, int errorC if (requestType == 0) { return body; } - String endpoint; - switch (requestType) { - case ErrorMessage.ADD_TO_BASKET_CODE: - endpoint = "basket"; - break; - case ErrorMessage.CHECKOUT_CODE: - endpoint = "checkout"; - break; - case ErrorMessage.EXECUTE_ORDER_CODE: - endpoint = "execute"; - break; - case ErrorMessage.PAYMENT_SDK_CODE: - endpoint = "payment"; - break; - case ErrorMessage.PRICE_CODE: - endpoint = "price"; - break; - default: - endpoint = "unhandledError"; - } + String endpoint = switch (requestType) { + case ErrorMessage.ADD_TO_BASKET_CODE -> "basket"; + case ErrorMessage.CHECKOUT_CODE -> "checkout"; + case ErrorMessage.EXECUTE_ORDER_CODE -> "execute"; + case ErrorMessage.PAYMENT_SDK_CODE -> "payment"; + case ErrorMessage.PRICE_CODE -> "price"; + case ErrorMessage.NO_SKU_CODE -> "sku"; + default -> "unhandledError"; + }; body.append(String.format("%s", endpoint)); // change the default value to -1 cuz in case of BillingClient return errorCode 0 for price load. if (errorCode == -1) {