mirror of
https://github.com/snazy2000/SnipeitPS.git
synced 2025-12-13 09:52:30 +00:00
Merge pull request #93 from PetriAsi/fix/invoke-snipeitmethod-error-handling-#91
If api request to snipe fails, don't continue, just throw error
This commit is contained in:
commit
26e67d2b29
1 changed files with 3 additions and 2 deletions
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue