diff --git a/JiraPS/Public/Remove-JiraIssue.ps1 b/JiraPS/Public/Remove-JiraIssue.ps1 index 801d3c33..e4a86912 100644 --- a/JiraPS/Public/Remove-JiraIssue.ps1 +++ b/JiraPS/Public/Remove-JiraIssue.ps1 @@ -13,12 +13,11 @@ function Remove-JiraIssue { [ValidateScript( { if (("JiraPS.Issue" -notin $_.PSObject.TypeNames) -and (($_ -isnot [String]))) { - $errorItem = [System.Management.Automation.ErrorRecord]::new( - ([System.ArgumentException]"Invalid Type for Parameter"), - 'ParameterType.NotJiraIssue', - [System.Management.Automation.ErrorCategory]::InvalidArgument, - $_ - ) + $exception = ([System.ArgumentException]"Invalid Type for Parameter") #fix code highlighting] + $errorId = 'ParameterType.NotJiraIssue' + $errorCategory = 'InvalidArgument' + $errorTarget = $_ + $errorItem = New-Object -TypeName "System.Management.Automation.ErrorRecord" -ArgumentList $exception,$errorId,$errorCategory,$errorTarget $errorItem.ErrorDetails = "Wrong object type provided for Issue. Expected [JiraPS.Issue] or [String], but was $($_.GetType().Name)" $PSCmdlet.ThrowTerminatingError($errorItem) <#