Skip to content

Commit

Permalink
Merge pull request #800 from albig/fix-geturl
Browse files Browse the repository at this point in the history
[BUGFIX] Catch guzzle exceptions in getUrl.
  • Loading branch information
Alexander Bigga committed Apr 8, 2022
2 parents fa6baf7 + bba8c07 commit c82f36d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Classes/Common/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,12 @@ public static function getUrl(string $url)
'User-Agent' => $extConf['useragent'] ?? 'Kitodo.Presentation Proxy',
],
];
$response = $requestFactory->request($url, 'GET', $configuration);
try {
$response = $requestFactory->request($url, 'GET', $configuration);
} catch (\Exception $e) {
self::log('Could not fetch data from URL "' . $url . '". Error: ' . $e->getMessage() . '.', LOG_SEVERITY_WARNING);
return false;
}
$content = $response->getBody()->getContents();

return $content;
Expand Down

0 comments on commit c82f36d

Please sign in to comment.