Skip to content

Commit 9193668

Browse files
committed
Eagerly print stacktrace of uncaught exceptions in case of hang tests
1 parent d0774bc commit 9193668

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/kotlinx-coroutines-core/test/TestBase.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,11 @@ public actual open class TestBase actual constructor() {
118118
initPoolsBeforeTest()
119119
threadsBefore = currentThreads()
120120
originalUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler()
121-
Thread.setDefaultUncaughtExceptionHandler({ t, e -> uncaughtExceptions.add(e) })
121+
Thread.setDefaultUncaughtExceptionHandler({ t, e ->
122+
println("Uncaught exception in thread $t: $e")
123+
e.printStackTrace()
124+
uncaughtExceptions.add(e)
125+
})
122126
}
123127

124128
@After

0 commit comments

Comments
 (0)