Commit e313417b authored by Vincent Petry's avatar Vincent Petry Committed by GitHub
Browse files

Merge pull request #26145 from owncloud/storage-503-bettermessage-debuglog

Storage 503 message improvements
parents ccadd7fc 8106f714
......@@ -45,6 +45,10 @@ class ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin {
'Sabre\DAV\Exception\Forbidden' => true,
// Custom exception similar to NotAuthenticated
'OCA\DAV\Connector\Sabre\Exception\PasswordLoginForbidden' => true,
// Happens when an external storage or federated share is temporarily
// not available
'Sabre\DAV\Exception\StorageNotAvailableException' => true,
'OCP\Files\StorageNotAvailableException' => true,
];
/** @var string */
......@@ -89,6 +93,14 @@ class ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin {
$level = \OCP\Util::DEBUG;
}
$previous = $ex->getPrevious();
if ($previous !== null) {
$previousExceptionClass = get_class($previous);
if (isset($this->nonFatalExceptions[$previousExceptionClass])) {
$level = \OCP\Util::DEBUG;
}
}
$message = $ex->getMessage();
if ($ex instanceof Exception) {
if (empty($message)) {
......
......@@ -167,7 +167,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', 0, $e);
} catch (StorageInvalidException $e) {
throw new \Sabre\DAV\Exception\NotFound('Storage ' . $path . ' is invalid');
} catch (LockedException $e) {
......
......@@ -81,7 +81,7 @@ try {
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) {
......
......@@ -1586,7 +1586,7 @@
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;
......
......@@ -2827,7 +2827,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);
......
......@@ -57,7 +57,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);
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment