Skip to content

Commit c53a915

Browse files
authored
Added try-catch to clearCache method (#49)
1 parent a9077c4 commit c53a915

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

FlagsmithClient/src/main/java/com/flagsmith/Flagsmith.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import com.flagsmith.internal.FlagsmithRetrofitService
1515
import com.flagsmith.internal.enqueueWithResult
1616
import kotlinx.coroutines.flow.MutableStateFlow
1717
import okhttp3.Cache
18+
import java.io.IOException
1819

1920
/**
2021
* Flagsmith
@@ -175,7 +176,11 @@ class Flagsmith constructor(
175176
.also { lastUsedIdentity = identity }
176177

177178
fun clearCache() {
178-
cache?.evictAll()
179+
try {
180+
cache?.evictAll()
181+
} catch (e: IOException) {
182+
Log.e("Flagsmith", "Error clearing cache", e)
183+
}
179184
}
180185

181186
private fun getFeatureFlag(

0 commit comments

Comments
 (0)