Not that the samples don't work or aren't good as is. However when extending them the exception handling fail if the search exception result isn't in json format.
In the above, if the $_.ErrorDetails isn't json, then it fails and the error isn't shown.
In the example, remove the sort information to force a bad request. and you'll get:
ConvertFrom-Json: /Users/rob.buskens/Documents/Code2/idn-data-extract/idn-id-invoke-paginate.ps1:20:95 Line | 20 | … ng Invoke-ListAccounts: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) | ~~~~~~~~~~~~~~~~ | Cannot bind argument to parameter 'InputObject' because it is null. Exception occurred when calling Invoke-ListAccounts: Response headers: null
Whereas the actual error is:
Exception occurred when calling Search-Post:System.Management.Automation.RuntimeException: Error! The required Search parameter must include exactly one sort parameter to paginate properly.
Response headers: null
Not that the samples don't work or aren't good as is. However when extending them the exception handling fail if the search exception result isn't in json format.
In the above, if the $_.ErrorDetails isn't json, then it fails and the error isn't shown.
In the example, remove the sort information to force a bad request. and you'll get:
ConvertFrom-Json: /Users/rob.buskens/Documents/Code2/idn-data-extract/idn-id-invoke-paginate.ps1:20:95 Line | 20 | … ng Invoke-ListAccounts: {0}" -f ($_.ErrorDetails | ConvertFrom-Json)) | ~~~~~~~~~~~~~~~~ | Cannot bind argument to parameter 'InputObject' because it is null. Exception occurred when calling Invoke-ListAccounts: Response headers: null
Whereas the actual error is: Exception occurred when calling Search-Post:System.Management.Automation.RuntimeException: Error! The required Search parameter must include exactly one sort parameter to paginate properly. Response headers: null