From 2768d91804267097e244cdea30157ba4d0860ea2 Mon Sep 17 00:00:00 2001 From: "Artem.Bukhonov" Date: Wed, 7 Aug 2024 21:19:36 +0200 Subject: [PATCH] Do not log CancellationException in Logger.catch() --- .../rd-core/src/main/kotlin/com/jetbrains/rd/util/Logger.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rd-kt/rd-core/src/main/kotlin/com/jetbrains/rd/util/Logger.kt b/rd-kt/rd-core/src/main/kotlin/com/jetbrains/rd/util/Logger.kt index 643fed36c..5245e0883 100644 --- a/rd-kt/rd-core/src/main/kotlin/com/jetbrains/rd/util/Logger.kt +++ b/rd-kt/rd-core/src/main/kotlin/com/jetbrains/rd/util/Logger.kt @@ -116,7 +116,11 @@ object RdDefaultErrorLoggerHolder { inline fun Logger.catch(comment: String?, action:() -> Unit) { try { action() - } catch (e : Throwable) { + } + catch (ce: CancellationException) { + throw ce + } + catch (e : Throwable) { val sfx = "${e.javaClass.name} ${e.message}" + if (comment.isNullOrBlank()) "" else " ($comment)" error("Catch $sfx", e) }