If apirequest fails, dont continue, just throw error

This commit is contained in:
Petri Asikainen 2021-05-17 07:55:25 +03:00
parent cb66a0112a
commit 738b4c6051

View file

@ -72,8 +72,9 @@
$webResponse = Invoke-WebRequest @splatParameters
}
catch {
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Failed to get an answer from the server"
$webResponse = $_.Exception.Response
#Write-Verbose "[$($MyInvocation.MyCommand.Name)] Failed to get an answer from the server"
#$webResponse = $_.Exception.Response
throw "[$($MyInvocation.MyCommand.Name)] Failed to get an answer from the server. $($_.Exception.Response)"
}
Write-Debug "[$($MyInvocation.MyCommand.Name)] Executed WebRequest. Access $webResponse to see details"