From 0f2eec981140d9dc5d635f6a82cc6f24c686b14f Mon Sep 17 00:00:00 2001 From: "stu126940@mail.uni-kiel.de" <stu126940@mail.uni-kiel.de> Date: Mon, 4 Apr 2022 09:06:00 +0200 Subject: [PATCH] Enhance code quality by only catching specific exception typ --- .../kotlin/theodolite/execution/operator/ClusterSetup.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/theodolite/src/main/kotlin/theodolite/execution/operator/ClusterSetup.kt b/theodolite/src/main/kotlin/theodolite/execution/operator/ClusterSetup.kt index 5eb34a759..e67be01ea 100644 --- a/theodolite/src/main/kotlin/theodolite/execution/operator/ClusterSetup.kt +++ b/theodolite/src/main/kotlin/theodolite/execution/operator/ClusterSetup.kt @@ -1,5 +1,6 @@ package theodolite.execution.operator +import io.fabric8.kubernetes.client.KubernetesClientException import io.fabric8.kubernetes.client.NamespacedKubernetesClient import io.fabric8.kubernetes.client.dsl.MixedOperation import io.fabric8.kubernetes.client.dsl.Resource @@ -84,8 +85,9 @@ class ClusterSetup( labelValue = "theodolite", context = serviceMonitorContext ) - } catch (e: Exception) { - logger.warn { "Service monitors could not be cleaned up. It may be that service monitors are not registered by the Kubernetes API." } + } catch (e: KubernetesClientException) { + logger.warn { "Service monitors could not be cleaned up. It may be that service monitors are not registered by the Kubernetes API."} + logger.debug { "Error is: ${e.message}" } } } } \ No newline at end of file -- GitLab