Merge pull request #249 from Icinga:feature/rewrite_exception_handler

Feature: Rewrite exception handler

Improves internal exception handler to get rid if misplaced `:` and adds all fields properly
This commit is contained in:
Lord Hepipud 2021-05-28 21:08:40 +02:00 committed by GitHub
commit 7ddc77c494
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -21,6 +21,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
* [#241](https://github.com/Icinga/icinga-powershell-framework/pull/241) Ensures we use TLS 1.1 and 1.2 for REST-Api calls, as used certificates in general are created with these * [#241](https://github.com/Icinga/icinga-powershell-framework/pull/241) Ensures we use TLS 1.1 and 1.2 for REST-Api calls, as used certificates in general are created with these
* [#243](https://github.com/Icinga/icinga-powershell-framework/pull/243) Adds stacktrace output for exceptions in case plugin execution fails * [#243](https://github.com/Icinga/icinga-powershell-framework/pull/243) Adds stacktrace output for exceptions in case plugin execution fails
* [#248](https://github.com/Icinga/icinga-powershell-framework/pull/248) Improves `Test-IcingaPerformanceCounterCategory` by creating an object for the Performance Counter category provided and checking if it is a valid object instead of relying on the registry which might not contain all categories in the correct language. * [#248](https://github.com/Icinga/icinga-powershell-framework/pull/248) Improves `Test-IcingaPerformanceCounterCategory` by creating an object for the Performance Counter category provided and checking if it is a valid object instead of relying on the registry which might not contain all categories in the correct language.
* [#249](https://github.com/Icinga/icinga-powershell-framework/pull/249) Improves internal exception handler to get rid if misplaced `:` and adds all fields properly
* [#250](https://github.com/Icinga/icinga-powershell-framework/pull/250) Improve error handling on plugin execution by informing the user if the plugin is simply not installed or the entire module was not loaded because of errors or missing dependencies * [#250](https://github.com/Icinga/icinga-powershell-framework/pull/250) Improve error handling on plugin execution by informing the user if the plugin is simply not installed or the entire module was not loaded because of errors or missing dependencies
### Bugfixes ### Bugfixes

View file

@ -64,8 +64,12 @@ function Exit-IcingaThrowException()
break; break;
} }
} }
} else { }
if ($null -eq $ExceptionMessageLib -Or [string]::IsNullOrEmpty($ExceptionName)) {
$ExceptionName = [string]::Format('{0} Exception', $ExceptionTypeString); $ExceptionName = [string]::Format('{0} Exception', $ExceptionTypeString);
if ([string]::IsNullOrEmpty($InputString)) {
$InputString = $ExceptionThrown;
}
$ExceptionThrown = [string]::Format( $ExceptionThrown = [string]::Format(
'{0} exception occured:{1}{2}', '{0} exception occured:{1}{2}',
$ExceptionTypeString, $ExceptionTypeString,