Refactor IStorage

This commit is contained in:
Philipp
2021-08-01 14:00:48 +02:00
parent 5dcdf2322e
commit 29c7552df5
11 changed files with 121 additions and 55 deletions

View File

@@ -52,12 +52,12 @@ class ExternalResource implements IStorage
try {
$fetchResult = HTTPSignature::fetchRaw($data->url, $data->uid, ['accept_content' => '']);
} catch (Exception $exception) {
throw new StorageException(sprintf('External resource failed to get %s', $reference), $exception->getCode(), $exception);
throw new ReferenceStorageException(sprintf('External resource failed to get %s', $reference), $exception->getCode(), $exception);
}
if ($fetchResult->isSuccess()) {
return $fetchResult->getBody();
} else {
throw new StorageException(sprintf('External resource failed to get %s', $reference), $fetchResult->getReturnCode(), new Exception($fetchResult->getBody()));
throw new ReferenceStorageException(sprintf('External resource failed to get %s', $reference), $fetchResult->getReturnCode(), new Exception($fetchResult->getBody()));
}
}