Merge pull request #254 from snazy2000/develop

Fail when snipe it returns unauthorized
This commit is contained in:
Petri Asikainen 2021-12-18 12:26:06 +02:00 committed by GitHub
commit 9e014ad06b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -144,6 +144,10 @@ function Invoke-SnipeitMethod {
# This could be handled nicely in an function such as:
# ResolveError $response -WriteError
Write-Error $($webResponse.messages | Out-String)
} elseif ( $webResponse.StatusCode -eq 'Unauthorized') {
Write-Verbose "[$($MyInvocation.MyCommand.Name)] An Unauthorized response was received"
Write-Error "Cannot connect to Snipe It: Unauthorized."
return $false
} else {
#update operations return payload
if ($webResponse.payload) {