File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
app/src/main/kotlin/com/livetl/android/data/feed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import kotlinx.coroutines.Dispatchers
1313import kotlinx.coroutines.SupervisorJob
1414import kotlinx.coroutines.withContext
1515import kotlinx.serialization.json.Json
16+ import timber.log.Timber
1617import javax.inject.Inject
1718
1819class FeedService @Inject constructor(
@@ -23,7 +24,7 @@ class FeedService @Inject constructor(
2324 suspend fun getFeed (
2425 organization : String? = "Hololive ",
2526 status : StreamStatus ,
26- ): List <Stream > = withContext(Dispatchers .IO ) {
27+ ): List <Stream > = withContext(SupervisorJob () + Dispatchers .IO ) {
2728 val result = client.get<HttpResponse > {
2829 url {
2930 baseUrl()
@@ -43,8 +44,13 @@ class FeedService @Inject constructor(
4344 baseHeaders()
4445 }
4546
46- val response: HolodexVideosResponse = json.decodeFromString(result.readText())
47- response.items
47+ try {
48+ val response: HolodexVideosResponse = json.decodeFromString(result.readText())
49+ response.items
50+ } catch (e: Exception ) {
51+ Timber .e(e)
52+ emptyList()
53+ }
4854 }
4955
5056 suspend fun getVideoInfo (videoId : String ): Stream = withContext(SupervisorJob () + Dispatchers .IO ) {
You can’t perform that action at this time.
0 commit comments