icinga-powershell-framework/lib/icinga/exception/Get-IcingaLastExceptionId.psm1

20 lines
469 B
PowerShell
Raw Normal View History

<#
.SYNOPSIS
This function returns the HRESULT unique value thrown by the last exception
.DESCRIPTION
This function returns the HRESULT unique value thrown by the last exception
.OUTPUTS
System.String
#>
function Get-IcingaLastExceptionId()
{
if ([string]::IsNullOrEmpty($Error)) {
return '';
}
[string]$ExceptionId = ([string]($Error.FullyQualifiedErrorId)).Split(',')[0].Split(' ')[1];
$Error.Clear();
return $ExceptionId;
}