Catch errors on discover request tab (#765)

## Description
Handle errors on the Discover/Jellyseerr requests tab preventing crashes

Note: this PR fixes the crash, but the error was a 400, which is likely
due to the older Jellyseerr version.

### Related issues
Fixes #764
This commit is contained in:
Ray 2026-01-24 19:23:15 -05:00 committed by GitHub
parent fc0de2144d
commit 47e54aa675
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View file

@ -40,6 +40,7 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.update
@ -112,6 +113,9 @@ class SeerrRequestsViewModel
state.update { it.copy(requests = DataLoadingState.Success(results)) }
}
}.catch { ex ->
Timber.e(ex, "Error fetching requests")
state.update { it.copy(requests = DataLoadingState.Error(ex)) }
}.launchIn(viewModelScope)
}