Properly set exception in FailedStorage
This commit is contained in:
parent
f603c57751
commit
8e8f5cdddf
|
@ -35,6 +35,7 @@ use OCA\Files_external\Service\UserStoragesService;
|
||||||
use OCA\Files_External\Service\UserGlobalStoragesService;
|
use OCA\Files_External\Service\UserGlobalStoragesService;
|
||||||
use OCA\Files_External\Lib\StorageConfig;
|
use OCA\Files_External\Lib\StorageConfig;
|
||||||
use OCA\Files_External\Lib\FailedStorage;
|
use OCA\Files_External\Lib\FailedStorage;
|
||||||
|
use OCP\Files\StorageNotAvailableException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make the old files_external config work with the new public mount config api
|
* Make the old files_external config work with the new public mount config api
|
||||||
|
@ -134,7 +135,9 @@ class ConfigAdapter implements IMountProvider {
|
||||||
try {
|
try {
|
||||||
$availability = $impl->getAvailability();
|
$availability = $impl->getAvailability();
|
||||||
if (!$availability['available'] && !Availability::shouldRecheck($availability)) {
|
if (!$availability['available'] && !Availability::shouldRecheck($availability)) {
|
||||||
$impl = new FailedStorage(['exception' => null]);
|
$impl = new FailedStorage([
|
||||||
|
'exception' => new StorageNotAvailableException('Storage with mount id ' . $storage->getId() . ' is not available')
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// propagate exception into filesystem
|
// propagate exception into filesystem
|
||||||
|
|
|
@ -39,6 +39,9 @@ class FailedStorage extends Common {
|
||||||
*/
|
*/
|
||||||
public function __construct($params) {
|
public function __construct($params) {
|
||||||
$this->e = $params['exception'];
|
$this->e = $params['exception'];
|
||||||
|
if (!$this->e) {
|
||||||
|
throw new \InvalidArgumentException('Missing "exception" argument in FailedStorage constructor');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId() {
|
public function getId() {
|
||||||
|
|
Loading…
Reference in New Issue