summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-01-08 12:50:01 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2014-01-08 13:02:54 (GMT)
commit6bf0706c74e340aed8767f1a6b13674b7681a35c (patch)
tree17c77535bf26ffddeb4ac0a46af9c187a446c0a8
parentf16aba537e0252bd5725a42306cb298c99077a3a (diff)
downloadiRony-6bf0706c74e340aed8767f1a6b13674b7681a35c.tar.gz
Log SabreDAV exceptions that end up as error code 500 (regardless of debug logging) in order track those mysterious errors
-rw-r--r--public_html/index.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/public_html/index.php b/public_html/index.php
index 66b3d0c..b076c43 100644
--- a/public_html/index.php
+++ b/public_html/index.php
@@ -8,7 +8,7 @@
* @version 0.2.5
* @author Thomas Bruederli <bruederli@kolabsys.com>
*
- * Copyright (C) 2013, Kolab Systems AG <contact@kolabsys.com>
+ * Copyright (C) 2013-2014, Kolab Systems AG <contact@kolabsys.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -167,6 +167,19 @@ if (getenv('DAVBROWSER')) {
$server->addPlugin(new \Sabre\DAV\Browser\Plugin());
}
+// log exceptions in iRony error log
+$server->subscribeEvent('exception', function($e){
+ if (!($e instanceof \Sabre\DAV\Exception) || $e->getHTTPCode() == 500) {
+ rcube::raise_error(array(
+ 'code' => 500,
+ 'type' => 'php',
+ 'file' => $e->getFile(),
+ 'line' => $e->getLine(),
+ 'message' => $e->getMessage() . " (error 500)\n" . $e->getTraceAsString(),
+ ), true, false);
+ }
+});
+
// finally, process the request
$server->exec();