Skip to content

Commit

Permalink
Handle notfound errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordy Groenewoud committed Feb 17, 2025
1 parent 38524d7 commit 054a296
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions New-ApiRetryCommand.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ function New-ApiRetryCommand
$done = $true
}
catch {
if ($Error[0].Exception.Message -like "*not found*" -or $Error[0].Exception.Message -like "*notfound*") {
Write-Error ("API call failed because the resource was not found.") -ErrorAction Continue
Break
}
if ($retryCount -ge $maxRetries) {
Write-Error ("API call failed the maximum number of $($maxRetries) times.") -ErrorAction Continue
Break
Expand Down

0 comments on commit 054a296

Please sign in to comment.