]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix code from PR comments
authorJesús Macias <jmacias@solidgear.es>
Thu, 26 Nov 2015 07:26:07 +0000 (08:26 +0100)
committerMorris Jobke <hey@morrisjobke.de>
Thu, 3 Dec 2015 08:58:55 +0000 (09:58 +0100)
apps/files_external/controller/storagescontroller.php
lib/public/files/extstorageauthexception.php
lib/public/files/extstoragebadconfigexception.php
lib/public/files/extstorageconnectionexception.php
lib/public/files/extstoragetimeoutexception.php
lib/public/files/storagenotavailableexception.php

index 3f781ef655d6baf308c03b54ac5179e85ec20db0..76096f76656e9d9721a8c73acc6b49ff5d23e59e 100644 (file)
@@ -241,29 +241,9 @@ abstract class StoragesController extends Controller {
                                \OC_Mount_Config::STATUS_INDETERMINATE,
                                $this->l10n->t('Insufficient data: %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 (StorageNotAvailableException $e) {
                        $storage->setStatus(
-                               \OC_Mount_Config::STATUS_ERROR,
+                               $e->getCode(),
                                $this->l10n->t('%s', [$e->getMessage()])
                        );
                } catch (\Exception $e) {
index 4f070b6c0edb8c72918bd9485c796cc43a12973d..7e7e6f5caa6adea95c3f2e3dfd6e17af8d182ff0 100644 (file)
@@ -37,8 +37,8 @@ class ExtStorageAuthException extends StorageNotAvailableException {
         * @param \Exception $previous
         * @since 9.0.0
         */
-       public function __construct($message = '', $code, \Exception $previous = null) {
+       public function __construct($message = '', \Exception $previous = null) {
                $l = \OC::$server->getL10N('core');
-               parent::__construct($message, $l->t('External storage unauthorized'), 3, $previous);
+               parent::__construct($l->t('External storage unauthorized. %s', $message), self::STATUS_UNAUTHORIZED, $previous);
        }
 }
index 869c2d1d1390bd30c82d09d2e35bfe84719e6bae..beb7ff32c811610a308964dca495e3b36f25c034 100644 (file)
@@ -37,9 +37,9 @@ class ExtStorageBadConfigException extends StorageNotAvailableException {
         * @param \Exception $previous
         * @since 9.0.0
         */
-       public function __construct($message = '', $code, \Exception $previous = null) {
+       public function __construct($message = '', \Exception $previous = null) {
                $l = \OC::$server->getL10N('core');
-               parent::__construct($message, $l->t('External storage incomplete configuration'), 2, $previous);
+               parent::__construct($l->t('External storage incomplete configuration. %s', $message), self::STATUS_INCOMPLETE_CONF, $previous);
        }
 
 }
index 472d5cd6c52a9c905070ad53b5ca312402c3a9b4..96d2551ddad78eaa0fa02eb8f569cf23c773e632 100644 (file)
@@ -37,8 +37,8 @@ class ExtStorageConnectionException extends StorageNotAvailableException {
         * @param \Exception $previous
         * @since 9.0.0
         */
-       public function __construct($message = '', $code, \Exception $previous = null) {
+       public function __construct($message = '', \Exception $previous = null) {
                $l = \OC::$server->getL10N('core');
-               parent::__construct($message, $l->t('External storage connection error'), 5, $previous);
+               parent::__construct($l->t('External storage connection error. %s', $message), self::STATUS_NETWORK_ERROR, $previous);
        }
 }
index 99932776a8088989db8c45b05fead582d330bb96..208f75214323f3ce4d85ea9cfaa7a11a59c0ef14 100644 (file)
@@ -37,8 +37,8 @@ class ExtStorageTimeoutException extends StorageNotAvailableException {
         * @param \Exception $previous
         * @since 9.0.0
         */
-       public function __construct($message = '', $code, \Exception $previous = null) {
+       public function __construct($message = '', \Exception $previous = null) {
                $l = \OC::$server->getL10N('core');
-               parent::__construct($message, $l->t('External storage connection timeout'), 4, $previous);
+               parent::__construct($l->t('External storage connection timeout. %s', $message), self::STATUS_TIMEOUT, $previous);
        }
 }
index a6665b38ce13818a616309b214b446770c651a3b..fe270e76b4ef927f6674629513e6fda18365645f 100644 (file)
@@ -37,6 +37,11 @@ use OC\HintException;
  */
 class StorageNotAvailableException extends HintException {
 
+       const STATUS_INCOMPLETE_CONF = 3;
+       const STATUS_UNAUTHORIZED = 4;
+       const STATUS_TIMEOUT = 5;
+       const STATUS_NETWORK_ERROR = 6;
+
        /**
         * StorageNotAvailableException constructor.
         *