Skip to content

Commit

Permalink
use error boundry to capture exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
tore-statsig committed Aug 11, 2022
1 parent d412faa commit dcb9a84
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/main/java/com/statsig/androidsdk/Store.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,31 +44,31 @@ internal class Store (private var userID: String?, private var customIDs: Map<St
cacheById = mutableMapOf()

if (cachedResponse != null) {
try {
Statsig.errorBoundary.capture({
val type = object : TypeToken<MutableMap<String, Cache>>() {}.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<MutableMap<String, APIDynamicConfig>>() {}.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()
Expand Down

0 comments on commit dcb9a84

Please sign in to comment.