Completed
Push — master ( 547f5a...4e0c07 )
by Joas
39s
created
apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php 1 patch
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -37,76 +37,76 @@
 block discarded – undo
37 37
 use Sabre\DAV\Exception\ServiceUnavailable;
38 38
 
39 39
 class ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin {
40
-	protected $nonFatalExceptions = [
41
-		NotAuthenticated::class => true,
42
-		// If tokenauth can throw this exception (which is basically as
43
-		// NotAuthenticated. So not fatal.
44
-		PasswordLoginForbidden::class => true,
45
-		// the sync client uses this to find out whether files exist,
46
-		// so it is not always an error, log it as debug
47
-		NotFound::class => true,
48
-		// this one mostly happens when the same file is uploaded at
49
-		// exactly the same time from two clients, only one client
50
-		// wins, the second one gets "Precondition failed"
51
-		PreconditionFailed::class => true,
52
-		// forbidden can be expected when trying to upload to
53
-		// read-only folders for example
54
-		Forbidden::class => true,
55
-		// Happens when an external storage or federated share is temporarily
56
-		// not available
57
-		StorageNotAvailableException::class => true,
58
-	];
40
+    protected $nonFatalExceptions = [
41
+        NotAuthenticated::class => true,
42
+        // If tokenauth can throw this exception (which is basically as
43
+        // NotAuthenticated. So not fatal.
44
+        PasswordLoginForbidden::class => true,
45
+        // the sync client uses this to find out whether files exist,
46
+        // so it is not always an error, log it as debug
47
+        NotFound::class => true,
48
+        // this one mostly happens when the same file is uploaded at
49
+        // exactly the same time from two clients, only one client
50
+        // wins, the second one gets "Precondition failed"
51
+        PreconditionFailed::class => true,
52
+        // forbidden can be expected when trying to upload to
53
+        // read-only folders for example
54
+        Forbidden::class => true,
55
+        // Happens when an external storage or federated share is temporarily
56
+        // not available
57
+        StorageNotAvailableException::class => true,
58
+    ];
59 59
 
60
-	/** @var string */
61
-	private $appName;
60
+    /** @var string */
61
+    private $appName;
62 62
 
63
-	/** @var ILogger */
64
-	private $logger;
63
+    /** @var ILogger */
64
+    private $logger;
65 65
 
66
-	/**
67
-	 * @param string $loggerAppName app name to use when logging
68
-	 * @param ILogger $logger
69
-	 */
70
-	public function __construct($loggerAppName, $logger) {
71
-		$this->appName = $loggerAppName;
72
-		$this->logger = $logger;
73
-	}
66
+    /**
67
+     * @param string $loggerAppName app name to use when logging
68
+     * @param ILogger $logger
69
+     */
70
+    public function __construct($loggerAppName, $logger) {
71
+        $this->appName = $loggerAppName;
72
+        $this->logger = $logger;
73
+    }
74 74
 
75
-	/**
76
-	 * This initializes the plugin.
77
-	 *
78
-	 * This function is called by \Sabre\DAV\Server, after
79
-	 * addPlugin is called.
80
-	 *
81
-	 * This method should set up the required event subscriptions.
82
-	 *
83
-	 * @param \Sabre\DAV\Server $server
84
-	 * @return void
85
-	 */
86
-	public function initialize(\Sabre\DAV\Server $server) {
75
+    /**
76
+     * This initializes the plugin.
77
+     *
78
+     * This function is called by \Sabre\DAV\Server, after
79
+     * addPlugin is called.
80
+     *
81
+     * This method should set up the required event subscriptions.
82
+     *
83
+     * @param \Sabre\DAV\Server $server
84
+     * @return void
85
+     */
86
+    public function initialize(\Sabre\DAV\Server $server) {
87 87
 
88
-		$server->on('exception', array($this, 'logException'), 10);
89
-	}
88
+        $server->on('exception', array($this, 'logException'), 10);
89
+    }
90 90
 
91
-	/**
92
-	 * Log exception
93
-	 *
94
-	 */
95
-	public function logException(\Exception $ex) {
96
-		$exceptionClass = get_class($ex);
97
-		$level = \OCP\Util::FATAL;
98
-		if (isset($this->nonFatalExceptions[$exceptionClass]) ||
99
-			(
100
-				$exceptionClass === ServiceUnavailable::class &&
101
-				$ex->getMessage() === 'System in maintenance mode.'
102
-			)
103
-		) {
104
-			$level = \OCP\Util::DEBUG;
105
-		}
91
+    /**
92
+     * Log exception
93
+     *
94
+     */
95
+    public function logException(\Exception $ex) {
96
+        $exceptionClass = get_class($ex);
97
+        $level = \OCP\Util::FATAL;
98
+        if (isset($this->nonFatalExceptions[$exceptionClass]) ||
99
+            (
100
+                $exceptionClass === ServiceUnavailable::class &&
101
+                $ex->getMessage() === 'System in maintenance mode.'
102
+            )
103
+        ) {
104
+            $level = \OCP\Util::DEBUG;
105
+        }
106 106
 
107
-		$this->logger->logException($ex, [
108
-			'app' => $this->appName,
109
-			'level' => $level,
110
-		]);
111
-	}
107
+        $this->logger->logException($ex, [
108
+            'app' => $this->appName,
109
+            'level' => $level,
110
+        ]);
111
+    }
112 112
 }
Please login to merge, or discard this patch.