Fudge
02/02/2021, 9:35 PM@Test
fun tryToThrow1() {
GlobalScope.launch {
throw RuntimeException()
}
Thread.sleep(500)
}
it logs the exception to the console instead of throwing normally https://paste.ee/p/reWaF .
Adding a coroutine exception handler does the same (https://paste.ee/p/Lgjri):
@Test
fun tryToThrow2() {
GlobalScope.launch(CoroutineExceptionHandler { _, throwable -> throw throwable }) {
throw RuntimeException()
}
Thread.sleep(500)
}
Trying to further overload the thread UncaughtExceptionHandler, completely breaks Coroutines and makes it log a single line instead (instead of just throwing, like I want it to and it should)
@Test
fun tryToThrow3() {
GlobalScope.launch(CoroutineExceptionHandler { _, throwable -> throw throwable }) {
Thread.setDefaultUncaughtExceptionHandler { _, e -> throw e }
throw RuntimeException()
}
Thread.sleep(1000)
}
Exception: kotlinx.coroutines.CoroutinesInternalError thrown from the UncaughtExceptionHandler in thread "DefaultDispatcher-worker-1"