Skip to content

Commit dcb9a84

Browse files
committed
use error boundry to capture exceptions
1 parent d412faa commit dcb9a84

File tree

1 file changed

+9
-9
lines changed
  • src/main/java/com/statsig/androidsdk

1 file changed

+9
-9
lines changed

src/main/java/com/statsig/androidsdk/Store.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,31 +44,31 @@ internal class Store (private var userID: String?, private var customIDs: Map<St
4444
cacheById = mutableMapOf()
4545

4646
if (cachedResponse != null) {
47-
try {
47+
Statsig.errorBoundary.capture({
4848
val type = object : TypeToken<MutableMap<String, Cache>>() {}.type
4949
cacheById = gson.fromJson(cachedResponse, type) ?: cacheById
50-
} catch (_: Exception) {
50+
}, {
5151
StatsigUtil.removeFromSharedPrefs(sharedPrefs, CACHE_BY_USER_KEY)
52-
}
52+
})
5353
}
5454

5555
stickyDeviceExperiments = mutableMapOf()
5656
if (cachedDeviceValues != null) {
57-
try {
57+
Statsig.errorBoundary.capture({
5858
val type = object : TypeToken<MutableMap<String, APIDynamicConfig>>() {}.type
5959
stickyDeviceExperiments = gson.fromJson(cachedDeviceValues, type) ?: stickyDeviceExperiments
60-
} catch (_: Exception) {
60+
}, {
6161
StatsigUtil.removeFromSharedPrefs(sharedPrefs, STICKY_DEVICE_EXPERIMENTS_KEY)
62-
}
62+
})
6363
}
6464

6565
localOverrides = StatsigOverrides(mutableMapOf(), mutableMapOf())
6666
if (cachedLocalOverrides != null) {
67-
try {
67+
Statsig.errorBoundary.capture({
6868
localOverrides = gson.fromJson(cachedLocalOverrides, StatsigOverrides::class.java)
69-
} catch (_: Exception) {
69+
}, {
7070
StatsigUtil.removeFromSharedPrefs(sharedPrefs, LOCAL_OVERRIDES_KEY)
71-
}
71+
})
7272
}
7373
reason = EvaluationReason.Uninitialized
7474
currentCache = loadCacheForCurrentUser()

0 commit comments

Comments
 (0)