[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.
This commit is contained in:
Alexander Bigga 2022-04-07 23:04:04 +02:00
parent dcd4104ce0
commit 4e64a036eb
1 changed files with 6 additions and 1 deletions

View File

@ -909,7 +909,12 @@ class Helper
'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;