When a command, such as New-JiraIssue fails (and the server returns an error message), two things are going wrong:
the error is not printed (except when it is a string)
a cmdlet, such as New-JiraIssue will try to use properties of an empty object
Steps To Reproduce
I ♥ PS> new-jiraissue -project HCC -IssueType Task -Summary "test" -Fields @{customfield_43300 = @{id = 77777}}
Get-JiraIssue : Cannot validate argument on parameter 'Key'. The argument is null or empty. Provide an argument that
is not null or empty, and then try the command again.
At C:\Users\Lipkau\Projects\jiraps\JiraPS\Public\New-JiraIssue.ps1:162 char:46
+ Write-Output (Get-JiraIssue -Key $result.Key -Credential ...
+ ~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-JiraIssue], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Get-JiraIssue
Expected behavior
I ♥ PS▌new-jiraissue -project HCC -IssueType Task -Summary "test" -Fields @{customfield_43300 = @{id = 77777}}
Invoke-JiraMethod :
customfield_43300
-----------------
Field 'customfield_43300' cannot be set. It is not on the appropriate screen, or unknown.
At C:\Users\Lipkau\Projects\jiraps\JiraPS\Public\New-JiraIssue.ps1:157 char:27
+ if ($result = Invoke-JiraMethod @parameter) {
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidResult: (:) [Invoke-JiraMethod], RuntimeException
+ FullyQualifiedErrorId : InvalidResponse.Status400,Invoke-JiraMethod
Description
When a command, such as
New-JiraIssue
fails (and the server returns an error message), two things are going wrong:New-JiraIssue
will try to use properties of an empty objectSteps To Reproduce
Expected behavior
Screenshots
Thanks to @thefonz for reporting this on slack