mirror of
https://github.com/snazy2000/SnipeitPS.git
synced 2025-12-13 01:42:29 +00:00
Merge pull request #253 from PetriAsi/fix/#252
Fail when request is unauthorized
This commit is contained in:
commit
7ac8a5c9bd
1 changed files with 4 additions and 0 deletions
|
|
@ -144,6 +144,10 @@ function Invoke-SnipeitMethod {
|
||||||
# This could be handled nicely in an function such as:
|
# This could be handled nicely in an function such as:
|
||||||
# ResolveError $response -WriteError
|
# ResolveError $response -WriteError
|
||||||
Write-Error $($webResponse.messages | Out-String)
|
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 {
|
} else {
|
||||||
#update operations return payload
|
#update operations return payload
|
||||||
if ($webResponse.payload) {
|
if ($webResponse.payload) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue