Skip to content

Commit

Permalink
fix(YSP-446): guard against invalid endpoint URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
dblanken-yale committed Oct 31, 2024
1 parent 6d85aa4 commit f267417
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f267417

Please sign in to comment.