mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[rdct-tests] always include exception cause in failure stacktrace
GitOrigin-RevId: a9006c0f60439b01d3efbd360bb59349480f23f3
This commit is contained in:
committed by
intellij-monorepo-bot
parent
53caa81e0e
commit
8f8b2ae2d3
+9
-8
@@ -9,13 +9,15 @@ import java.util.concurrent.TimeoutException
|
||||
import kotlin.time.Duration
|
||||
|
||||
@ApiStatus.Internal
|
||||
val coroutineDumpPrefix = "CoroutineDump:"
|
||||
val coroutineDumpPrefix: String = "CoroutineDump:"
|
||||
|
||||
@ApiStatus.Internal
|
||||
suspend fun <T> withTimeoutDumping(title: String,
|
||||
timeout: Duration,
|
||||
failMessageProducer: (() -> String)? = null,
|
||||
action: suspend () -> T): T = coroutineScope {
|
||||
suspend fun <T> withTimeoutDumping(
|
||||
title: String,
|
||||
timeout: Duration,
|
||||
failMessageProducer: (() -> String)? = null,
|
||||
action: suspend () -> T,
|
||||
): T = coroutineScope {
|
||||
val outerScope = childScope(title)
|
||||
|
||||
val deferred = outerScope.async { action() }
|
||||
@@ -25,8 +27,6 @@ suspend fun <T> withTimeoutDumping(title: String,
|
||||
withTimeout(timeout) { deferred.await() }
|
||||
}
|
||||
catch (e: TimeoutCancellationException) {
|
||||
val message = "$title: Has not finished in $timeout."
|
||||
|
||||
//println(buildString {
|
||||
// appendLine(message)
|
||||
// // see com.intellij.testFramework.common.TimeoutKt.timeoutRunBlocking
|
||||
@@ -36,7 +36,8 @@ suspend fun <T> withTimeoutDumping(title: String,
|
||||
val coroutinesDump = dumpCoroutines(outerScope)
|
||||
val failMessage = outerScope.async { failMessageProducer?.invoke() }.await()
|
||||
throw TimeoutException(buildString {
|
||||
appendLine(message)
|
||||
append("$title[timeout=$timeout] failed:")
|
||||
appendLine(e.stackTraceToString())
|
||||
if (!failMessage.isNullOrBlank()) {
|
||||
appendLine(failMessage)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user