```@Test fun test() { runBlocking(Dispatchers.Def...
# coroutines
p
Copy code
@Test
fun test() {
	runBlocking(Dispatchers.Default) {
		try {
			coroutineScope {
				throw RuntimeException("test")
			}
		} catch (e: Exception) {
			e.printStackTrace() // why cause is not null and is the same as e?
		}
	}
}
Copy code
java.lang.RuntimeException: test
	at Test$test$1$1.invokeSuspend(CalcTest.kt:23)
	at Test$test$1$1.invoke(CalcTest.kt)
	at Test$test$1$1.invoke(CalcTest.kt)
	at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:61)
	at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:261)
	at Test$test$1.invokeSuspend(CalcTest.kt:22)
	at _COROUTINE._BOUNDARY._(CoroutineDebugging.kt:42)
	at Test$test$1.invokeSuspend(CalcTest.kt:22)
Caused by: java.lang.RuntimeException: test
	at Test$test$1$1.invokeSuspend(CalcTest.kt:23)
	at Test$test$1$1.invoke(CalcTest.kt)
	at Test$test$1$1.invoke(CalcTest.kt)
	at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:61)
	at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:261)
	at Test$test$1.invokeSuspend(CalcTest.kt:22)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
c
Exceptions are caught and rethrown internally by the Coroutines mechanism. The rethrown exception is a copy of the real one, with the real one as its cause. https://github.com/Kotlin/kotlinx.coroutines/blob/master/docs/topics/debugging.md#stacktrace-recovery