From dcb9a84541f5f9905224f84930bd93a1a110e2a7 Mon Sep 17 00:00:00 2001 From: tore-statsig <74584483+tore-statsig@users.noreply.github.com> Date: Thu, 11 Aug 2022 15:19:23 -0700 Subject: [PATCH] use error boundry to capture exceptions --- src/main/java/com/statsig/androidsdk/Store.kt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/statsig/androidsdk/Store.kt b/src/main/java/com/statsig/androidsdk/Store.kt index 27de481..e43dc3f 100644 --- a/src/main/java/com/statsig/androidsdk/Store.kt +++ b/src/main/java/com/statsig/androidsdk/Store.kt @@ -44,31 +44,31 @@ internal class Store (private var userID: String?, private var customIDs: Map>() {}.type cacheById = gson.fromJson(cachedResponse, type) ?: cacheById - } catch (_: Exception) { + }, { StatsigUtil.removeFromSharedPrefs(sharedPrefs, CACHE_BY_USER_KEY) - } + }) } stickyDeviceExperiments = mutableMapOf() if (cachedDeviceValues != null) { - try { + Statsig.errorBoundary.capture({ val type = object : TypeToken>() {}.type stickyDeviceExperiments = gson.fromJson(cachedDeviceValues, type) ?: stickyDeviceExperiments - } catch (_: Exception) { + }, { StatsigUtil.removeFromSharedPrefs(sharedPrefs, STICKY_DEVICE_EXPERIMENTS_KEY) - } + }) } localOverrides = StatsigOverrides(mutableMapOf(), mutableMapOf()) if (cachedLocalOverrides != null) { - try { + Statsig.errorBoundary.capture({ localOverrides = gson.fromJson(cachedLocalOverrides, StatsigOverrides::class.java) - } catch (_: Exception) { + }, { StatsigUtil.removeFromSharedPrefs(sharedPrefs, LOCAL_OVERRIDES_KEY) - } + }) } reason = EvaluationReason.Uninitialized currentCache = loadCacheForCurrentUser()