Andrea Giuliano
08/28/2020, 4:59 PM@Test
fun testingScope() = runBlocking {
myfun1()
}
suspend fun myfun1() = coroutineScope {
val handler = CoroutineExceptionHandler { _, exception ->
println("CoroutineExceptionHandler got $exception")
}
launch(handler) {
throw Exception()
}
}
the test is failing because the exception gets bubbled up to the runblocking although I’m using an exception handler. Doing some debugging I’ve seen that the handler is set in the right child context, but still never called. Does anybody know why?sean
08/28/2020, 6:21 PMAndrea Giuliano
08/28/2020, 7:04 PMsean
08/28/2020, 11:14 PMawait()
call returned from async { }
within a supervisorScope
Evan R.
08/31/2020, 3:10 AMAndrea Giuliano
09/03/2020, 2:55 PMsupervisedScope
then you can inject the errorHandler and it works as expected