Open HowardWolosky opened 4 years ago
I would also suggest that rather than using throw
, the module should use a helper function to build a System.Management.Automation.ErrorRecord
object then call $PSCmdlet.ThrowTerminatingError
. See Error Handling in PowerShell - Best Practices for more info.
This allows the creation of a richer error object, specifically with the ability to set the FullyQualifiedErrorId
property to a different value to the Exception.Message
property and doesn't expose unnecessary internal function code in the error output.
That all sounds awesome to me. Any interest in tackling it yourself? You already sound well-versed in this area...
I'll take a look at it once PR #177 is merged, as that PR is making significant changes to the Invoke-GHRestMethod
function.
Issue Details
This was identified by @X-Guardian as part of his verification for #200.
Steps to reproduce the issue
Observe the difference in behavior when calling this code between PS 5 and PS 7
Verbose logs showing the problem
n/a
Suggested solution to the issue
I did some initial investigation into this, and the additional work that will be needed is creating an equivalent version of
Get-HttpWebResponseContent
for aHttpResponseMessage
. Initially looking, the methods to get the stream are only async, so either an additional wrapper needs to be written to convert the async method to be synchronous, or an alternate approach will need to be found.Along the way, a little bit of refactoring may need to happen in the error handling of
Invoke-GHRestMethod
as well.Requested Assignment
I'm just reporting this problem, but don't want to fix it.
Operating System
PowerShell Version
Module Version