From 8f798d1003f53fbb7d169bb919aea57513afc024 Mon Sep 17 00:00:00 2001 From: KotlinGeekDev Date: Thu, 31 Oct 2024 19:02:38 +0100 Subject: [PATCH] Add some error handling in the feed filter. --- .../amethyst/ui/dal/FollowSetFeedFilter.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/dal/FollowSetFeedFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/dal/FollowSetFeedFilter.kt index 466d851b8..bae8b10b9 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/dal/FollowSetFeedFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/dal/FollowSetFeedFilter.kt @@ -20,9 +20,11 @@ */ package com.vitorpamplona.amethyst.ui.dal +import android.util.Log import com.vitorpamplona.amethyst.model.Account import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.FollowSet import kotlinx.coroutines.launch +import kotlin.coroutines.cancellation.CancellationException class FollowSetFeedFilter( val account: Account, @@ -32,7 +34,13 @@ class FollowSetFeedFilter( override fun feed(): List { if (account.userProfile().followSets.isEmpty()) { account.scope.launch { - account.getFollowSetNotes() + try { + account.getFollowSetNotes() + } catch (e: Exception) { + if (e is CancellationException) throw e + Log.e("HiddenAccountsFeedFilter", "Failed to load follow lists: ${e.message}") + null + } } } return account.followSetNotesFlow().value.map { account.mapNoteToFollowSet(it) }