Improve newsletter.bounces.processor.py:
[platal.git] / classes / xorg.php
index c53f31a..e920dc1 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2011 Polytechnique.org                              *
+ *  Copyright (C) 2003-2013 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -37,6 +37,7 @@ class Xorg extends Platal
             'events',
             'forums',
             'fusionax',
+            'fxletter',
             'gadgets',
             'geoloc',
             'googleapps',
@@ -77,6 +78,31 @@ class Xorg extends Platal
         $page->assign_by_ref('platal', $this);
         $page->run();
     }
+
+    public function setup_raven()
+    {
+        $sentry_dsn = self::globals()->core->sentry_dsn;
+
+        if (strlen($sentry_dsn) == 0) {
+            return null;
+        }
+
+        require_once('raven/lib/Raven/Autoloader.php');
+
+        Raven_Autoloader::register();
+
+        return new Raven_Client($sentry_dsn);
+    }
+
+    protected function report_error($error)
+    {
+        parent::report_error($error);
+
+        $raven = $this->setup_raven();
+        if ($raven != null) {
+            $raven->captureException($error);
+        }
+    }
 }
 
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: