summaryrefslogtreecommitdiffstats
path: root/apps/files_external
diff options
context:
space:
mode:
authorJesús Macias <jmacias@solidgear.es>2015-11-25 17:52:58 +0100
committerMorris Jobke <hey@morrisjobke.de>2015-12-03 09:57:59 +0100
commit7cd13f462a41ebde9e151bb7e753a842262ad416 (patch)
tree758eb76b5e908d92e95ea45d8ce11ba44f3c34cc /apps/files_external
parentb17f26834df37819656b83936c34d8957c344fac (diff)
downloadnextcloud-server-7cd13f462a41ebde9e151bb7e753a842262ad416.tar.gz
nextcloud-server-7cd13f462a41ebde9e151bb7e753a842262ad416.zip
Add new external storage exceptions for different errors
Diffstat (limited to 'apps/files_external')
-rw-r--r--apps/files_external/controller/storagescontroller.php62
1 files changed, 24 insertions, 38 deletions
diff --git a/apps/files_external/controller/storagescontroller.php b/apps/files_external/controller/storagescontroller.php
index 7efe7611407..ddd7fe6df16 100644
--- a/apps/files_external/controller/storagescontroller.php
+++ b/apps/files_external/controller/storagescontroller.php
@@ -242,44 +242,30 @@ abstract class StoragesController extends Controller {
$this->l10n->t('Insufficient data: %s', [$e->getMessage()])
);
} catch (StorageNotAvailableException $e) {
- switch ($e->getCode()) {
- case 1:
- $storage->setStatus(
- \OC_Mount_Config::STATUS_ERROR,
- $this->l10n->t('%s', [$e->getMessage()])
- );
- break;
- case 3:
- $storage->setStatus(
- \OC_Mount_Config::STATUS_INCOMPLETE_CONF,
- $this->l10n->t('Incomplete configuration. %s', [$e->getMessage()])
- );
- break;
- case 4:
- $storage->setStatus(
- \OC_Mount_Config::STATUS_UNAUTHORIZED,
- $this->l10n->t('Unauthorized. %s', [$e->getMessage()])
- $e->getMessage()
- );
- break;
- case 5:
- $storage->setStatus(
- \OC_Mount_Config::STATUS_TIMEOUT,
- $this->l10n->t('Timeout. %s', [$e->getMessage()])
- );
- break;
- case 6:
- $storage->setStatus(
- \OC_Mount_Config::STATUS_NETWORK_ERROR,
- $this->l10n->t('Network error. %s', [$e->getMessage()])
- );
- break;
- default:
- $storage->setStatus(
- \OC_Mount_Config::STATUS_ERROR,
- $this->l10n->t('%s', [$e->getMessage()])
- );
- }
+ $storage->setStatus(
+ \OC_Mount_Config::STATUS_ERROR,
+ $this->l10n->t('%s', [$e->getMessage()])
+ );
+ } catch (ExtStorageBadConfigException $e) {
+ $storage->setStatus(
+ $e->getCode(),
+ $this->l10n->t('%s', [$e->getMessage()])
+ );
+ } catch (ExtStorageAuthException $e) {
+ $storage->setStatus(
+ $e->getCode(),
+ $this->l10n->t('%s', [$e->getMessage()])
+ );
+ } catch (ExtStorageTimeoutException $e) {
+ $storage->setStatus(
+ $e->getCode(),
+ $this->l10n->t('%s', [$e->getMessage()])
+ );
+ } catch (ExtStorageConnectionException $e) {
+ $storage->setStatus(
+ $e->getCode(),
+ $this->l10n->t('%s', [$e->getMessage()])
+ );
} catch (\Exception $e) {
// FIXME: convert storage exceptions to StorageNotAvailableException
$storage->setStatus(