Skip to content

Commit 089029f

Browse files
committed
use error boundry to capture exceptions
1 parent 8c95b65 commit 089029f

File tree

1 file changed

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

1 file changed

+9
-9
lines changed

Diff for: src/main/java/com/statsig/androidsdk/Store.kt

+9-9
Original file line numberDiff line numberDiff line change
@@ -45,31 +45,31 @@ internal class Store (private val sharedPrefs: SharedPreferences, user: StatsigU
4545
currentUserCacheKey = user.getCacheKey()
4646

4747
if (cachedResponse != null) {
48-
try {
48+
Statsig.errorBoundary.capture({
4949
val type = object : TypeToken<MutableMap<String, Cache>>() {}.type
5050
cacheById = gson.fromJson(cachedResponse, type) ?: cacheById
51-
} catch (_: Exception) {
51+
}, {
5252
StatsigUtil.removeFromSharedPrefs(sharedPrefs, CACHE_BY_USER_KEY)
53-
}
53+
})
5454
}
5555

5656
stickyDeviceExperiments = mutableMapOf()
5757
if (cachedDeviceValues != null) {
58-
try {
58+
Statsig.errorBoundary.capture({
5959
val type = object : TypeToken<MutableMap<String, APIDynamicConfig>>() {}.type
6060
stickyDeviceExperiments = gson.fromJson(cachedDeviceValues, type) ?: stickyDeviceExperiments
61-
} catch (_: Exception) {
61+
}, {
6262
StatsigUtil.removeFromSharedPrefs(sharedPrefs, STICKY_DEVICE_EXPERIMENTS_KEY)
63-
}
63+
})
6464
}
6565

6666
localOverrides = StatsigOverrides(mutableMapOf(), mutableMapOf())
6767
if (cachedLocalOverrides != null) {
68-
try {
68+
Statsig.errorBoundary.capture({
6969
localOverrides = gson.fromJson(cachedLocalOverrides, StatsigOverrides::class.java)
70-
} catch (_: Exception) {
70+
}, {
7171
StatsigUtil.removeFromSharedPrefs(sharedPrefs, LOCAL_OVERRIDES_KEY)
72-
}
72+
})
7373
}
7474
reason = EvaluationReason.Uninitialized
7575
currentCache = loadCacheForCurrentUser()

0 commit comments

Comments
 (0)