Peter
02/09/2024, 9:46 AMCoroutineScope
, that applies for all jobs?
Let's say I have following:
val scope = CoroutineScope(dispatcher + SupervisorJob())
Is following a correct way to handle all exceptions, for all jobs, lunched inside that scope?
val handler = CoroutineExceptionHandler { _, exception ->
println("$exception")
}
val scope = CoroutineScope(dispatcher + SupervisorJob() + handler)
Djuro
02/09/2024, 10:41 AMCancellationException
is not caught and is instead propagated to ensure structured concurrency is not violated (you shouldn't catch it anyways when working with coroutines except in some edge cases where cleanup is to be performed)