From f2674178dc33451ad64ef78bc4b797b33c5fa098 Mon Sep 17 00:00:00 2001 From: David Blankenship Date: Thu, 31 Oct 2024 09:29:10 -0400 Subject: [PATCH] fix(YSP-446): guard against invalid endpoint URLs --- .../modules/custom/ys_localist/src/LocalistManager.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_localist/src/LocalistManager.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_localist/src/LocalistManager.php index b2898a0f3..366ef05c8 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_localist/src/LocalistManager.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_localist/src/LocalistManager.php @@ -14,6 +14,7 @@ use Drupal\migrate\Plugin\MigrationInterface; use Drupal\migrate\Plugin\MigrationPluginManager; use GuzzleHttp\Client; +use GuzzleHttp\Exception\RequestException; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -204,7 +205,13 @@ public function getEndpointUrls($endpointType) { */ private function getMultiPageUrls($url) { $endpointUrls = []; - $response = $this->httpClient->get($url); + + try { + $response = $this->httpClient->get($url); + } + catch (RequestException $e) { + return $endpointUrls; + } $data = json_decode($response->getBody(), TRUE); $i = 1;