diff --git a/theodolite/src/main/kotlin/theodolite/patcher/PatcherFactory.kt b/theodolite/src/main/kotlin/theodolite/patcher/PatcherFactory.kt index 9350cecc46451a405a5d5445165c8991aede47c1..cdf115a0755e8794075884bf952db3b8d76f1f50 100644 --- a/theodolite/src/main/kotlin/theodolite/patcher/PatcherFactory.kt +++ b/theodolite/src/main/kotlin/theodolite/patcher/PatcherFactory.kt @@ -32,7 +32,7 @@ class PatcherFactory { k8sResources.filter { it.first == patcherDefinition.resource } .map { resource -> resource.second } .firstOrNull() - ?: throw DeploymentFailedException("Could not find resource ${patcherDefinition.resource}") + ?: throw InvalidPatcherConfigurationException("Could not find resource ${patcherDefinition.resource}") return try { when (patcherDefinition.type) { @@ -86,10 +86,10 @@ class PatcherFactory { ) else -> throw InvalidPatcherConfigurationException("Patcher type ${patcherDefinition.type} not found.") } - } catch (e: Exception) { + } catch (e: NullPointerException) { throw InvalidPatcherConfigurationException( "Could not create patcher with type ${patcherDefinition.type}" + - " Probably a required patcher argument was not specified." + " Probably a required patcher argument was not specified.", e ) } } diff --git a/theodolite/src/main/kotlin/theodolite/util/InvalidPatcherConfigurationException.kt b/theodolite/src/main/kotlin/theodolite/util/InvalidPatcherConfigurationException.kt index e8ecd11d524f5c365149ac0b37c7b985812f8c4b..81ea227d0d9871c2420a414d81749a34b97676b8 100644 --- a/theodolite/src/main/kotlin/theodolite/util/InvalidPatcherConfigurationException.kt +++ b/theodolite/src/main/kotlin/theodolite/util/InvalidPatcherConfigurationException.kt @@ -1,4 +1,4 @@ package theodolite.util -class InvalidPatcherConfigurationException(message: String) : Exception(message) +class InvalidPatcherConfigurationException(message: String, e: Exception? = null) : Exception(message, e)