From 4e64a036eb7cdc710afefb2f02d58856706d9fae Mon Sep 17 00:00:00 2001 From: Alexander Bigga Date: Thu, 7 Apr 2022 23:04:04 +0200 Subject: [PATCH] [BUGFIX] Catch guzzle exceptions in getUrl. If a location is not accessible, guzzle with throw an exception. This will stop the CLI indexing or reindexing job. In the backend this exception is shown on saving documents. --- Classes/Common/Helper.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Classes/Common/Helper.php b/Classes/Common/Helper.php index 56c1bd43b..a2547079b 100644 --- a/Classes/Common/Helper.php +++ b/Classes/Common/Helper.php @@ -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;