fix: make BusProNet response failures diagnosable and non-fatal
This commit is contained in:
@@ -6,6 +6,7 @@ use App\BusProNet\ApiClient;
|
||||
use App\BusProNet\ApiClientException;
|
||||
use App\BusProNet\Model\Country;
|
||||
use App\BusProNet\Model\NotificationResponse;
|
||||
use App\BusProNet\ResponseParserException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Contracts\Cache\CacheInterface;
|
||||
use Symfony\Contracts\Cache\ItemInterface;
|
||||
@@ -35,7 +36,8 @@ class CountryDataProvider
|
||||
|
||||
return $response->getItems();
|
||||
});
|
||||
} catch (ApiClientException $e) {
|
||||
} catch (ApiClientException|ResponseParserException $e) {
|
||||
$this->logger->error('Unable to fetch country base data from BusProNet: '.$e->getMessage());
|
||||
$countries = [];
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\BusProNet\ApiClient;
|
||||
use App\BusProNet\ApiClientException;
|
||||
use App\BusProNet\Model\Hotel;
|
||||
use App\BusProNet\Model\NotificationResponse;
|
||||
use App\BusProNet\ResponseParserException;
|
||||
use Psr\Cache\InvalidArgumentException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Contracts\Cache\CacheInterface;
|
||||
@@ -36,7 +37,8 @@ class HotelDataProvider
|
||||
|
||||
return $response->getItems();
|
||||
});
|
||||
} catch (ApiClientException|InvalidArgumentException $e) {
|
||||
} catch (ApiClientException|InvalidArgumentException|ResponseParserException $e) {
|
||||
$this->logger->error('Unable to fetch hotel base data from BusProNet: '.$e->getMessage());
|
||||
$hotels = [];
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\BusProNet\ApiClient;
|
||||
use App\BusProNet\ApiClientException;
|
||||
use App\BusProNet\Model\NotificationResponse;
|
||||
use App\BusProNet\Model\Pickup;
|
||||
use App\BusProNet\ResponseParserException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Contracts\Cache\CacheInterface;
|
||||
use Symfony\Contracts\Cache\ItemInterface;
|
||||
@@ -35,7 +36,8 @@ class PickupDataProvider
|
||||
|
||||
return $response->getItems();
|
||||
});
|
||||
} catch (ApiClientException $e) {
|
||||
} catch (ApiClientException|ResponseParserException $e) {
|
||||
$this->logger->error('Unable to fetch pickup base data from BusProNet: '.$e->getMessage());
|
||||
$pickups = [];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user