tests [performanceTesting]: throw on exhausted focus retries so coroutineScope propagates the failure

completeExceptionally on the barrier only unblocks downstream chars via
await(), but the launch coroutine itself completed normally — so
coroutineScope never saw the failure. Now throw the exception after
completing the barrier, ensuring the typing command fails visibly.

GitOrigin-RevId: a0bbc1bd5fada3d6bd373cf19c9bc3d6c044bcc2
This commit is contained in:
Danil Tereshchenko
2026-02-12 14:36:57 +00:00
committed by intellij-monorepo-bot
parent 14de78a499
commit e7b6a80b0b
@@ -113,15 +113,14 @@ class DelayTypeCommand(text: String, line: Int) : PlaybackCommandCoroutineAdapte
delay(500)
}
if (!typed) {
barriers[i].completeExceptionally(
Exception("Focus was lost during typing. Current focus is in: " +
withContext(Dispatchers.EDT) {
KeyboardFocusManager.getCurrentKeyboardFocusManager().focusOwner?.javaClass ?: "null"
}))
}
else {
barriers[i].complete(Unit)
val ex = Exception("Focus was lost during typing. Current focus is in: " +
withContext(Dispatchers.EDT) {
KeyboardFocusManager.getCurrentKeyboardFocusManager().focusOwner?.javaClass ?: "null"
})
barriers[i].completeExceptionally(ex)
throw ex
}
barriers[i].complete(Unit)
}
}