try catch

This commit is contained in:
Thijs Stobbelaar 2023-09-27 22:03:57 +02:00
parent 576a2c2fc8
commit 875518abd3
2 changed files with 39 additions and 15 deletions

View file

@ -23,8 +23,13 @@ $headers = @{
'accept' = 'application/vnd.api+json'
'Authorization' = "$apiKey"
}
$claninfo = Invoke-RestMethod -Uri "https://api.pubg.com/shards/steam/clans/$clanid" -Method GET -Headers $headers
try {
$claninfo = Invoke-RestMethod -Uri "https://api.pubg.com/shards/steam/clans/$clanid" -Method GET -Headers $headers
} catch {
write-output "sleeping for 61 sec"
start-sleep -Seconds 61
$claninfo = Invoke-RestMethod -Uri "https://api.pubg.com/shards/steam/clans/$clanid" -Method GET -Headers $headers
}
# Get current date and time
$currentDateTime = Get-Date