Catch exception and replace with default data

pull/1710/head
Shuvo 10 months ago
parent b405e5a484
commit 9e36bdc5a6

@ -164,6 +164,14 @@ class NiaPreferencesDataSource @Inject constructor(
}
suspend fun getChangeListVersions() = userPreferences.data
.catch { exception ->
if (exception is IOException) {
Log.e("NiaPreferences", "Error reading user preferences.", exception)
emit(UserPreferences.getDefaultInstance())
} else {
throw exception
}
}
.map {
ChangeListVersions(
topicVersion = it.topicChangeListVersion,

Loading…
Cancel
Save