mirror of
https://github.com/friendica/friendica
synced 2025-05-06 10:24:10 +02:00
Refactor IStorage
This commit is contained in:
parent
5dcdf2322e
commit
29c7552df5
11 changed files with 121 additions and 55 deletions
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -131,6 +131,8 @@ class Filesystem implements ISelectableStorage
|
|||
if ($result === false) {
|
||||
throw new StorageException(sprintf('Filesystem storage failed to get data to "%s". Check your write permissions', $file));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue