From e7b6a80b0b58ad321f1106de76cd2ea945bb1dcb Mon Sep 17 00:00:00 2001 From: Danil Tereshchenko Date: Thu, 12 Feb 2026 14:13:35 +0400 Subject: [PATCH] tests [performanceTesting]: throw on exhausted focus retries so coroutineScope propagates the failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../commands/DelayTypeCommand.kt | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/DelayTypeCommand.kt b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/DelayTypeCommand.kt index 796e66deaf45..91b2f8cfa5dc 100644 --- a/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/DelayTypeCommand.kt +++ b/plugins/performanceTesting/core/src/com/jetbrains/performancePlugin/commands/DelayTypeCommand.kt @@ -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) } }