From 24ae0d9e8171df5c33d615a07bcb427f44919f55 Mon Sep 17 00:00:00 2001 From: tzugen Date: Wed, 9 Jun 2021 20:24:22 +0200 Subject: [PATCH] Catch all exceptions in GenericListModel This is how it used to be, before i changed it because detekt was complaining. --- .../org/moire/ultrasonic/fragment/GenericListModel.kt | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/GenericListModel.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/GenericListModel.kt index bf377eed..468802a2 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/GenericListModel.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/fragment/GenericListModel.kt @@ -10,8 +10,6 @@ import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.viewModelScope import androidx.swiperefreshlayout.widget.SwipeRefreshLayout -import java.net.ConnectException -import java.net.UnknownHostException import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext @@ -89,10 +87,8 @@ open class GenericListModel(application: Application) : try { load(isOffline, useId3Tags, musicService, refresh, bundle) - } catch (exception: ConnectException) { - handleException(exception, swipe.context) - } catch (exception: UnknownHostException) { - handleException(exception, swipe.context) + } catch (all: Exception) { + handleException(all, swipe.context) } }