Skip to content

Commit 73f8371

Browse files
committed
add logging to geoip lookip
1 parent 9ba4871 commit 73f8371

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Modules/CIPPCore/Public/Get-CIPPGeoIPLocation.ps1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ function Get-CIPPGeoIPLocation {
1212
return ($GeoIP.Data | ConvertFrom-Json)
1313
}
1414
$location = Invoke-CIPPRestMethod -Uri "https://geoipdb.azurewebsites.net/api/GetIPInfo?IP=$IP"
15-
if ($location.status -eq 'FAIL') { throw "Could not get location for $IP" }
15+
if ($location.status -eq 'FAIL') {
16+
Write-logMessage -API GeoIPLocation -message "Failed to get location for $IP. API returned status 'FAIL' with message: $($location.message)" -sev Warning
17+
throw "Could not get location for $IP"
18+
}
1619
$CacheGeo = @{
1720
PartitionKey = 'IP'
1821
RowKey = $IP

0 commit comments

Comments
 (0)