mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Added ability to force exception throwing
This commit is contained in:
parent
17d8308e1f
commit
2c04a1ff64
2 changed files with 13 additions and 7 deletions
3
cache/provider/eventlog/1781451901841216379518196991491710121821213111390108.lastcheck.json
vendored
Normal file
3
cache/provider/eventlog/1781451901841216379518196991491710121821213111390108.lastcheck.json
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"1781451901841216379518196991491710121821213111390108.lastcheck": 132132048543175098
|
||||||
|
}
|
||||||
|
|
@ -6,15 +6,18 @@ function Exit-IcingaThrowException()
|
||||||
[string]$CustomMessage,
|
[string]$CustomMessage,
|
||||||
[string]$ExceptionThrown,
|
[string]$ExceptionThrown,
|
||||||
[ValidateSet('Permission','Input','Unhandled')]
|
[ValidateSet('Permission','Input','Unhandled')]
|
||||||
[string]$ExceptionType = 'Unhandled'
|
[string]$ExceptionType = 'Unhandled',
|
||||||
|
[switch]$Force
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($null -eq $InputString -Or [string]::IsNullOrEmpty($InputString)) {
|
if ($Force -eq $FALSE) {
|
||||||
return;
|
if ($null -eq $InputString -Or [string]::IsNullOrEmpty($InputString)) {
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (-Not $InputString.Contains($StringPattern)) {
|
if (-Not $InputString.Contains($StringPattern)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$ExceptionMessageLib = $null;
|
$ExceptionMessageLib = $null;
|
||||||
|
|
@ -44,7 +47,7 @@ function Exit-IcingaThrowException()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$ExceptionName = 'Unhandled Exception';
|
$ExceptionName = 'Unhandled Exception';
|
||||||
$ExceptionThrown = [string]::Format(
|
$ExceptionThrown = [string]::Format(
|
||||||
'Unhandled exception occured:{0}{1}',
|
'Unhandled exception occured:{0}{1}',
|
||||||
"`r`n",
|
"`r`n",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue