Skip to content

Commit

Permalink
Merge pull request #254 from snazy2000/develop
Browse files Browse the repository at this point in the history
Fail when snipe it returns unauthorized
  • Loading branch information
PetriAsi committed Dec 18, 2021
2 parents e10f520 + 7ac8a5c commit 9e014ad
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions SnipeitPS/Private/Invoke-SnipeitMethod.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 9e014ad

Please sign in to comment.