Skip to content

Commit 449e81d

Browse files
committed
Do not log WebDAV maintenance mode exception
Log the maintenance mode exception only in debug level. Fixes #6124 Signed-off-by: Morris Jobke <[email protected]>
1 parent cf7c4a4 commit 449e81d

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

‎apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ public function initialize(\Sabre\DAV\Server $server) {
9090
public function logException(\Exception $ex) {
9191
$exceptionClass = get_class($ex);
9292
$level = \OCP\Util::FATAL;
93-
if (isset($this->nonFatalExceptions[$exceptionClass])) {
93+
if (isset($this->nonFatalExceptions[$exceptionClass]) ||
94+
($exceptionClass === 'Sabre\DAV\Exception\ServiceUnavailable' && $ex->getMessage() === 'System in maintenance mode.')) {
9495
$level = \OCP\Util::DEBUG;
9596
}
9697

‎apps/dav/tests/unit/Connector/Sabre/ExceptionLoggerPluginTest.php‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
use OC\Log;
2929
use PHPUnit_Framework_MockObject_MockObject;
3030
use Sabre\DAV\Exception\NotFound;
31+
use Sabre\DAV\Exception\ServiceUnavailable;
3132
use Sabre\DAV\Server;
3233
use Test\TestCase;
3334

@@ -77,6 +78,8 @@ public function testLogging($expectedLogLevel, $expectedMessage, $exception) {
7778
public function providesExceptions() {
7879
return [
7980
[0, '', new NotFound()],
81+
[0, 'System in maintenance mode.', new ServiceUnavailable('System in maintenance mode.')],
82+
[4, 'Upgrade needed', new InvalidPath('Upgrade needed')],
8083
[4, 'This path leads to nowhere', new InvalidPath('This path leads to nowhere')]
8184
];
8285
}

0 commit comments

Comments
 (0)