diff options
author | Guillaume Jacquart <guillaume.jacquart@hoodbrains.com> | 2023-05-03 15:40:14 +0000 |
---|---|---|
committer | Guillaume Jacquart <guillaume.jacquart@hoodbrains.com> | 2023-05-03 15:40:14 +0000 |
commit | 837fa2c6b4e61653bd4d14a94af8c48d859a7944 (patch) | |
tree | ae9d49ffcb909e685e5a21141a1facb6b45e6208 /app/src/main/java | |
parent | a0ee04ea9dbc0802c828afdf660eb37dc6fa350f (diff) |
1139: FIX crash in background
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/foundation/e/privacycentralapp/data/repositories/TrackersRepository.kt | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/app/src/main/java/foundation/e/privacycentralapp/data/repositories/TrackersRepository.kt b/app/src/main/java/foundation/e/privacycentralapp/data/repositories/TrackersRepository.kt index b5310e1..ae55371 100644 --- a/app/src/main/java/foundation/e/privacycentralapp/data/repositories/TrackersRepository.kt +++ b/app/src/main/java/foundation/e/privacycentralapp/data/repositories/TrackersRepository.kt @@ -18,12 +18,12 @@ package foundation.e.privacycentralapp.data.repositories import android.content.Context -import android.util.Log import com.google.gson.Gson import foundation.e.privacymodules.trackers.api.Tracker import retrofit2.Retrofit import retrofit2.converter.scalars.ScalarsConverterFactory import retrofit2.http.GET +import timber.log.Timber import java.io.File import java.io.FileInputStream import java.io.FileWriter @@ -45,8 +45,12 @@ class TrackersRepository(private val context: Context) { suspend fun update() { val api = ETrackersApi.build() - saveData(eTrackerFile, api.trackers()) - initTrackersFile() + try { + saveData(eTrackerFile, api.trackers()) + initTrackersFile() + } catch (e: Exception) { + Timber.e("While updating trackers", e) + } } private fun initTrackersFile() { @@ -64,7 +68,7 @@ class TrackersRepository(private val context: Context) { reader.close() inputStream.close() } catch (e: Exception) { - Log.e("TrackersRepository", "While parsing trackers in assets", e) + Timber.e("While parsing trackers in assets", e) } } |