]> source.dussan.org Git - nextcloud-server.git/commitdiff
Storage 503 message improvements 1883/head
authorVincent Petry <pvince81@owncloud.com>
Mon, 19 Sep 2016 10:17:06 +0000 (12:17 +0200)
committerMorris Jobke <hey@morrisjobke.de>
Mon, 24 Oct 2016 13:43:15 +0000 (15:43 +0200)
"Storage not available" is now "Storage temporarily not available".
Exceptions are now logged in DEBUG level, not FATAL.

apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php
apps/dav/lib/Connector/Sabre/ObjectTree.php
apps/files/ajax/list.php
apps/files/js/filelist.js
apps/files/tests/js/filelistSpec.js
lib/public/Files/StorageNotAvailableException.php

index 56a8b2b764153a7290667866fb0ca759511cf354..4f7c2286827e1016af1a14338e42636f8009fa25 100644 (file)
@@ -32,7 +32,7 @@ use Sabre\DAV\Exception;
 use Sabre\HTTP\Response;
 
 class ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin {
-       protected $nonFatalExceptions = array(
+       protected $nonFatalExceptions = [
                'Sabre\DAV\Exception\NotAuthenticated' => true,
                // If tokenauth can throw this exception (which is basically as
                // NotAuthenticated. So not fatal.
@@ -47,7 +47,10 @@ class ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin {
                // forbidden can be expected when trying to upload to
                // read-only folders for example
                'Sabre\DAV\Exception\Forbidden' => true,
-       );
+               // Happens when an external storage or federated share is temporarily
+               // not available
+               'Sabre\DAV\Exception\StorageNotAvailableException' => true,
+       ];
 
        /** @var string */
        private $appName;
index af1cf79e1db66df642c9776b1b945758806f1641..554a7ad86ca8a28ed135f70b395879e116962f0f 100644 (file)
@@ -159,7 +159,7 @@ class ObjectTree extends \Sabre\DAV\Tree {
                        try {
                                $info = $this->fileView->getFileInfo($path);
                        } catch (StorageNotAvailableException $e) {
-                               throw new \Sabre\DAV\Exception\ServiceUnavailable('Storage not available');
+                               throw new \Sabre\DAV\Exception\ServiceUnavailable('Storage is temporarily not available');
                        } catch (StorageInvalidException $e) {
                                throw new \Sabre\DAV\Exception\NotFound('Storage ' . $path . ' is invalid');
                        } catch (LockedException $e) {
index bb95f124dab7da740a621de7c15c20e62c4398bc..2cd097654351f30e9d9d8685b5018f40b290aa7a 100644 (file)
@@ -79,12 +79,12 @@ try {
        OCP\JSON::success(array('data' => $data));
 } catch (\OCP\Files\StorageNotAvailableException $e) {
        \OCP\Util::logException('files', $e);
-       OCP\JSON::error(array(
-               'data' => array(
+       OCP\JSON::error([
+               'data' => [
                        'exception' => '\OCP\Files\StorageNotAvailableException',
-                       'message' => $l->t('Storage not available')
-               )
-       ));
+                       'message' => $l->t('Storage is temporarily not available')
+               ]
+       ]);
 } catch (\OCP\Files\StorageInvalidException $e) {
        \OCP\Util::logException('files', $e);
        OCP\JSON::error(array(
index 159d008e6e6e5126166bceb297dcd4cd3bfd41a5..b8f605fe4ed5977393adaf137326330954d35874 100644 (file)
                                        this.changeDirectory('/');
                                        // TODO: read error message from exception
                                        OC.Notification.showTemporary(
-                                               t('files', 'Storage not available')
+                                               t('files', 'Storage is temporarily not available')
                                        );
                                }
                                return false;
index 304f8438a5994a8ea9f353e14f47fe3682b7a7d5..166059275695d343d4f947c5e3b889a672aaaaad 100644 (file)
@@ -2668,7 +2668,7 @@ describe('OCA.Files.FileList tests', function() {
                });
                it('redirects to root folder and shows notification in case of storage not available', function () {
                        expect(notificationStub.notCalled).toEqual(true);
-                       deferredList.reject(503, 'Storage not available');
+                       deferredList.reject(503, 'Storage is temporarily not available');
 
                        expect(fileList.getCurrentDirectory()).toEqual('/');
                        expect(getFolderContentsStub.calledTwice).toEqual(true);
index a28a66f25102c176b4df62a459ac7d412fd5a2b2..b6a5a70718a9d7d94a9eac2867d4a269e61e0d6e 100644 (file)
@@ -58,7 +58,7 @@ class StorageNotAvailableException extends HintException {
         */
        public function __construct($message = '', $code = self::STATUS_ERROR, \Exception $previous = null) {
                $l = \OC::$server->getL10N('core');
-               parent::__construct($message, $l->t('Storage not available'), $code, $previous);
+               parent::__construct($message, $l->t('Storage is temporarily not available'), $code, $previous);
        }
 
        /**