Catch all errors thrown by "fetchRaw"

This commit is contained in:
Michael 2023-02-26 14:08:33 +00:00
parent 6870ccc00e
commit 2b513a48c7
8 changed files with 64 additions and 28 deletions

View file

@ -57,6 +57,7 @@ class ExternalResource implements ICanReadFromStorage
try {
$fetchResult = HTTPSignature::fetchRaw($data->url, $data->uid, [HttpClientOptions::ACCEPT_CONTENT => [HttpClientAccept::IMAGE]]);
} catch (Exception $exception) {
Logger::notice('URL is invalid', ['url' => $data->url, 'error' => $exception]);
throw new ReferenceStorageException(sprintf('External resource failed to get %s', $reference), $exception->getCode(), $exception);
}
if (!empty($fetchResult) && $fetchResult->isSuccess()) {