summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-03-02 12:17:14 +0100
committerRobin Appelman <icewind@owncloud.com>2016-03-03 14:37:23 +0100
commit4255dd2b396050e757f77db86063f0f1420a87d5 (patch)
treee936e7012eb3fae6e2a23d7a88f80d302c5964eb
parent6990100e6ed6d1efe48e2688331df5ce364f9fd5 (diff)
downloadnextcloud-server-4255dd2b396050e757f77db86063f0f1420a87d5.tar.gz
nextcloud-server-4255dd2b396050e757f77db86063f0f1420a87d5.zip
Properly set exception in FailedStorage
-rw-r--r--apps/files_external/lib/config/configadapter.php5
-rw-r--r--apps/files_external/lib/failedstorage.php3
2 files changed, 7 insertions, 1 deletions
diff --git a/apps/files_external/lib/config/configadapter.php b/apps/files_external/lib/config/configadapter.php
index f097d55a316..d85e0f45631 100644
--- a/apps/files_external/lib/config/configadapter.php
+++ b/apps/files_external/lib/config/configadapter.php
@@ -35,6 +35,7 @@ use OCA\Files_external\Service\UserStoragesService;
use OCA\Files_External\Service\UserGlobalStoragesService;
use OCA\Files_External\Lib\StorageConfig;
use OCA\Files_External\Lib\FailedStorage;
+use OCP\Files\StorageNotAvailableException;
/**
* Make the old files_external config work with the new public mount config api
@@ -134,7 +135,9 @@ class ConfigAdapter implements IMountProvider {
try {
$availability = $impl->getAvailability();
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) {
// propagate exception into filesystem
diff --git a/apps/files_external/lib/failedstorage.php b/apps/files_external/lib/failedstorage.php
index 928d09e20f8..20cf43d74b2 100644
--- a/apps/files_external/lib/failedstorage.php
+++ b/apps/files_external/lib/failedstorage.php
@@ -39,6 +39,9 @@ class FailedStorage extends Common {
*/
public function __construct($params) {
$this->e = $params['exception'];
+ if (!$this->e) {
+ throw new \InvalidArgumentException('Missing "exception" argument in FailedStorage constructor');
+ }
}
public function getId() {