diff --git a/theodolite/src/main/kotlin/theodolite/benchmark/ConfigMapResourceSet.kt b/theodolite/src/main/kotlin/theodolite/benchmark/ConfigMapResourceSet.kt index ba50ee01637fabdb77eb94ffafb6a8ff350b88e8..1f89549fb4eabb86fa1a766627abe3bf7c1b3cc6 100644 --- a/theodolite/src/main/kotlin/theodolite/benchmark/ConfigMapResourceSet.kt +++ b/theodolite/src/main/kotlin/theodolite/benchmark/ConfigMapResourceSet.kt @@ -36,9 +36,9 @@ class ConfigMapResourceSet: ResourceSet, KubernetesResource { .data .filter { it.key.endsWith(".yaml") } // consider only yaml files, e.g. ignore readme files } catch (e: KubernetesClientException) { - throw DeploymentFailedException("can not find or read configmap: $name, error is: ${e.message}") + throw DeploymentFailedException("can not find or read configmap: $name", e) } catch (e: IllegalStateException) { - throw DeploymentFailedException("can not find configmap or data section is null $name, error is: ${e.message}") + throw DeploymentFailedException("can not find configmap or data section is null $name", e) } if (::files.isInitialized){ @@ -56,7 +56,7 @@ class ConfigMapResourceSet: ResourceSet, KubernetesResource { it.second.key, loader.loadK8sResource(it.first, it.second.value)) } } catch (e: IllegalArgumentException) { - throw DeploymentFailedException("Can not creat resource set from specified configmap" + e.message) + throw DeploymentFailedException("Can not creat resource set from specified configmap", e) } } @@ -68,7 +68,7 @@ class ConfigMapResourceSet: ResourceSet, KubernetesResource { return try { resourceAsMap?.get("kind") !! } catch (e: NullPointerException) { - throw DeploymentFailedException( "Could not find field kind of Kubernetes resource: ${resourceAsMap?.get("name")}" ) + throw DeploymentFailedException( "Could not find field kind of Kubernetes resource: ${resourceAsMap?.get("name")}", e) } } } \ No newline at end of file diff --git a/theodolite/src/main/kotlin/theodolite/benchmark/FileSystemResourceSet.kt b/theodolite/src/main/kotlin/theodolite/benchmark/FileSystemResourceSet.kt index 723f81cf1e1b509b62bdc5933c36a5f5ecb2b8fc..92df1bec3cd6f21b1f830e73b466f70e37a9f4c8 100644 --- a/theodolite/src/main/kotlin/theodolite/benchmark/FileSystemResourceSet.kt +++ b/theodolite/src/main/kotlin/theodolite/benchmark/FileSystemResourceSet.kt @@ -37,7 +37,7 @@ class FileSystemResourceSet: ResourceSet, KubernetesResource { loadSingleResource(resourceURL = it, client = client) } } catch (e: NullPointerException) { - throw DeploymentFailedException("Could not load files located in $path, error is: ${e.message}") + throw DeploymentFailedException("Could not load files located in $path", e) } } @@ -50,9 +50,9 @@ class FileSystemResourceSet: ResourceSet, KubernetesResource { try { kind = parser.parse(resourcePath, HashMap<String, String>()::class.java)?.get("kind")!! } catch (e: NullPointerException) { - throw DeploymentFailedException("Can not get Kind from resource $resourcePath, error is ${e.message}") + throw DeploymentFailedException("Can not get Kind from resource $resourcePath", e) } catch (e: FileNotFoundException){ - throw DeploymentFailedException("File $resourcePath not found") + throw DeploymentFailedException("File $resourcePath not found", e) } @@ -60,7 +60,7 @@ class FileSystemResourceSet: ResourceSet, KubernetesResource { val k8sResource = loader.loadK8sResource(kind, resourcePath) Pair(resourceURL, k8sResource) } catch (e: IllegalArgumentException) { - throw DeploymentFailedException("Could not load resource: $resourcePath, caused by exception: ${e.message}") + throw DeploymentFailedException("Could not load resource: $resourcePath", e) } } } \ No newline at end of file diff --git a/theodolite/src/main/kotlin/theodolite/util/DeploymentFailedException.kt b/theodolite/src/main/kotlin/theodolite/util/DeploymentFailedException.kt index 639a7c86c641cbdcba361410cf5e25fa56dd795f..9439024eede8fd66d04a85af16501fc136dc3d8f 100644 --- a/theodolite/src/main/kotlin/theodolite/util/DeploymentFailedException.kt +++ b/theodolite/src/main/kotlin/theodolite/util/DeploymentFailedException.kt @@ -1,4 +1,4 @@ package theodolite.util -class DeploymentFailedException(message: String) : Exception(message) \ No newline at end of file +class DeploymentFailedException(message: String, e: Exception? = null): Exception(message, e) \ No newline at end of file