mirror of
https://github.com/snazy2000/SnipeitPS.git
synced 2025-12-13 01:42:29 +00:00
Fail when request is unauthorized
This commit is contained in:
parent
ec40912018
commit
e2923cade8
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:
|
||||
# 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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue