Given more semantic cases in which a visit cannot be located

This commit is contained in:
Alejandro Celaya
2019-02-26 21:39:45 +01:00
parent c70077c525
commit 2d1d7357a3
4 changed files with 49 additions and 6 deletions

View File

@@ -30,12 +30,18 @@ class VisitService implements VisitServiceInterface
foreach ($results as $visit) {
$count++;
try {
/** @var Location $location */
$location = $geolocateVisit($visit);
} catch (IpCannotBeLocatedException $e) {
// Skip if the visit's IP could not be located
continue;
if (!$e->isNonLocatableAddress()) {
// Skip if the visit's IP could not be located because of an error
continue;
}
// If the IP address is non-locatable, locate it as empty to prevent next processes to pick it again
$location = Location::emptyInstance();
}
$location = new VisitLocation($location);