addamsson
04/23/2019, 6:59 AMTest
service to fail even if the Job
fails because each Job
is independent, I just want the error handling.
class Test : CoroutineScope {
override val coroutineContext = Dispatchers.Default + SupervisorJob()
fun doSomething(): Job {
val handler = CoroutineExceptionHandler { _, exception ->
// log error
}
return launch(handler) {
// do things
}
}
}
addamsson
04/24/2019, 10:20 AMgildor
04/24/2019, 10:21 AM// do things
, but it depends on case of courseaddamsson
04/24/2019, 10:50 AMaddamsson
04/24/2019, 10:50 AMhandler
because it might happen that an exception is thrown in the catch
blockaddamsson
04/24/2019, 10:50 AMaddamsson
04/24/2019, 10:51 AMgildor
04/24/2019, 12:44 PMaddamsson
04/24/2019, 1:55 PMaddamsson
04/24/2019, 1:55 PM