Skip to content

Commit

Permalink
Added try-catch to clearCache method (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
devapro committed Apr 29, 2024
1 parent a9077c4 commit c53a915
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion FlagsmithClient/src/main/java/com/flagsmith/Flagsmith.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.flagsmith.internal.FlagsmithRetrofitService
import com.flagsmith.internal.enqueueWithResult
import kotlinx.coroutines.flow.MutableStateFlow
import okhttp3.Cache
import java.io.IOException

/**
* Flagsmith
Expand Down Expand Up @@ -175,7 +176,11 @@ class Flagsmith constructor(
.also { lastUsedIdentity = identity }

fun clearCache() {
cache?.evictAll()
try {
cache?.evictAll()
} catch (e: IOException) {
Log.e("Flagsmith", "Error clearing cache", e)
}
}

private fun getFeatureFlag(
Expand Down

0 comments on commit c53a915

Please sign in to comment.