Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
namespace OCA\DAV\Connector\Sabre;

use OCP\ILogger;
use Sabre\DAV\Exception;
use Sabre\HTTP\Response;
use Sabre\DAV\Exception\ServiceUnavailable;

class ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin {
protected $nonFatalExceptions = [
Expand Down Expand Up @@ -90,7 +89,12 @@ public function initialize(\Sabre\DAV\Server $server) {
public function logException(\Exception $ex) {
$exceptionClass = get_class($ex);
$level = \OCP\Util::FATAL;
if (isset($this->nonFatalExceptions[$exceptionClass])) {
if (isset($this->nonFatalExceptions[$exceptionClass]) ||
(
$exceptionClass === ServiceUnavailable::class &&
$ex->getMessage() === 'System in maintenance mode.'
)
) {
$level = \OCP\Util::DEBUG;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
use OC\Log;
use PHPUnit_Framework_MockObject_MockObject;
use Sabre\DAV\Exception\NotFound;
use Sabre\DAV\Exception\ServiceUnavailable;
use Sabre\DAV\Server;
use Test\TestCase;

Expand Down Expand Up @@ -77,6 +78,8 @@ public function testLogging($expectedLogLevel, $expectedMessage, $exception) {
public function providesExceptions() {
return [
[0, '', new NotFound()],
[0, 'System in maintenance mode.', new ServiceUnavailable('System in maintenance mode.')],
[4, 'Upgrade needed', new ServiceUnavailable('Upgrade needed')],
[4, 'This path leads to nowhere', new InvalidPath('This path leads to nowhere')]
];
}
Expand Down