File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
app/src/main/java/otus/homework/coroutines Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -4,12 +4,19 @@ import androidx.lifecycle.ViewModel
4
4
import androidx.lifecycle.ViewModelProvider
5
5
import androidx.lifecycle.viewmodel.initializer
6
6
import androidx.lifecycle.viewmodel.viewModelFactory
7
+ import kotlinx.coroutines.CoroutineExceptionHandler
7
8
8
9
class CatsViewModel (
9
10
private val catsService : CatsService ,
10
11
private val imageService : ImageService
11
12
) : ViewModel() {
12
13
14
+ private val exceptionHandler = CoroutineExceptionHandler { _, throwable ->
15
+ CrashMonitor .trackWarning(throwable)
16
+ }
17
+
18
+
19
+
13
20
companion object {
14
21
fun provideFactory (
15
22
catsService : CatsService ,
Original file line number Diff line number Diff line change @@ -5,5 +5,5 @@ object CrashMonitor {
5
5
/* *
6
6
* Pretend this is Crashlytics/AppCenter
7
7
*/
8
- fun trackWarning (exception : Exception ) {}
8
+ fun trackWarning (exception : Throwable ) {}
9
9
}
You can’t perform that action at this time.
0 commit comments