Skip to content

Commit 773f898

Browse files
FantoomForNeVeR
authored andcommitted
(#291) Tests: fix cancellation exception being caught instead of rethrowing
1 parent fcc8782 commit 773f898

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/main/kotlin/com/intellij/plugin/powershell/lang/lsp/languagehost/LanguageServerEndpoint.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ class LanguageServerEndpoint(
233233
return@job result.await()
234234
} catch (e: Exception) {
235235
when (e) {
236+
is CancellationException -> throw e
236237
is PowerShellExtensionError -> {
237238
logger.warn("PowerShell extension error: ${e.message}")
238239
showPowerShellNotConfiguredNotification()

src/main/kotlin/com/intellij/plugin/powershell/lang/lsp/languagehost/PSLanguageHostUtils.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ private suspend fun readPowerShellVersion(exePath: String): PSVersionInfo {
8181

8282
PSVersionInfo.parse(stdOutReader.await().trim())
8383
} catch (e: Exception) {
84+
if(e is CancellationException) throw e
8485
PSLanguageHostUtils.LOG.warn("Command execution failed for ${commandLine.preparedCommandLine}", e)
8586
throw PowerShellControlFlowException(e.message, e.cause)
8687
} finally {

0 commit comments

Comments
 (0)