diff options
author | Jesús Macias <jmacias@solidgear.es> | 2015-11-25 11:58:54 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-12-03 09:57:54 +0100 |
commit | b17f26834df37819656b83936c34d8957c344fac (patch) | |
tree | 38ac3f18c04814135567d59a3db09567f2889bb2 /apps/files_external/controller | |
parent | c6bda8d6caf910cecc15adb0ef81ec96eafdfada (diff) | |
download | nextcloud-server-b17f26834df37819656b83936c34d8957c344fac.tar.gz nextcloud-server-b17f26834df37819656b83936c34d8957c344fac.zip |
Add different storage status codes managed by StoragedNotAvailableException
Diffstat (limited to 'apps/files_external/controller')
-rw-r--r-- | apps/files_external/controller/storagescontroller.php | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/apps/files_external/controller/storagescontroller.php b/apps/files_external/controller/storagescontroller.php index c66bd902d8d..7efe7611407 100644 --- a/apps/files_external/controller/storagescontroller.php +++ b/apps/files_external/controller/storagescontroller.php @@ -242,10 +242,44 @@ abstract class StoragesController extends Controller { $this->l10n->t('Insufficient data: %s', [$e->getMessage()]) ); } catch (StorageNotAvailableException $e) { - $storage->setStatus( - \OC_Mount_Config::STATUS_ERROR, - $e->getMessage() - ); + 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()]) + ); + } } catch (\Exception $e) { // FIXME: convert storage exceptions to StorageNotAvailableException $storage->setStatus( |