From 478d8f3566341d45bf36546a7a56b4d17e38513e Mon Sep 17 00:00:00 2001 From: Lord Hepipud Date: Fri, 27 Nov 2020 16:52:24 +0100 Subject: [PATCH] Fixes exception output not properly constructed --- lib/icinga/exception/Exit-IcingaThrowException.psm1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/icinga/exception/Exit-IcingaThrowException.psm1 b/lib/icinga/exception/Exit-IcingaThrowException.psm1 index 08e7487..0431292 100644 --- a/lib/icinga/exception/Exit-IcingaThrowException.psm1 +++ b/lib/icinga/exception/Exit-IcingaThrowException.psm1 @@ -52,11 +52,6 @@ function Exit-IcingaThrowException() [string]$ExceptionName = ''; [string]$ExceptionIWKB = $KnowledgeBaseId; - if ($ExceptionThrown -is [hashtable]) { - $ExceptionIWKB = $ExceptionThrown.IWKB; - $ExceptionThrown = $ExceptionThrown.Message; - } - if ($null -ne $ExceptionMessageLib) { foreach ($definedError in $ExceptionMessageLib.Keys) { if ($ExceptionMessageLib.$definedError -eq $ExceptionThrown) { @@ -74,6 +69,11 @@ function Exit-IcingaThrowException() ); } + if ($ExceptionThrown -is [hashtable]) { + $ExceptionIWKB = $ExceptionThrown.IWKB; + $ExceptionThrown = $ExceptionThrown.Message; + } + if ([string]::IsNullOrEmpty($ExceptionIWKB) -eq $FALSE) { $ExceptionIWKB = [string]::Format( '{0}{0}Further details can be found on the Icinga for Windows Knowledge base: https://icinga.com/docs/windows/latest/doc/knowledgebase/{1}',