Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattpiwik <matthieu.aubry@gmail.com>2008-08-04 04:11:03 +0400
committermattpiwik <matthieu.aubry@gmail.com>2008-08-04 04:11:03 +0400
commit2854426e8609e0f9e3ceac2e27327532bf00a408 (patch)
tree5214705435461179efecb331075a9830a21a5594 /core/ExceptionHandler.php
parent42b52b6d8a88b3fa4c4f3978c4e7bf00b1eac778 (diff)
oops i totally screwed up my last commit, deleting /modules instead of renaming it...
git-svn-id: http://dev.piwik.org/svn/trunk@587 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'core/ExceptionHandler.php')
-rw-r--r--core/ExceptionHandler.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/core/ExceptionHandler.php b/core/ExceptionHandler.php
new file mode 100644
index 0000000000..27ad00a9c7
--- /dev/null
+++ b/core/ExceptionHandler.php
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Piwik - Open source web analytics
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
+ * @version $Id: ExceptionHandler.php 444 2008-04-11 13:38:22Z johmathe $
+ *
+ * @package Piwik_Helper
+ */
+
+require_once "core/Piwik.php";
+
+/**
+ * Exception handler used to display nicely exceptions in Piwik
+ *
+ * @package Piwik_Helper
+ */
+function Piwik_ExceptionHandler(Exception $exception)
+{
+ try {
+ Zend_Registry::get('logger_exception')->log($exception);
+ } catch(Exception $e) {
+ // case when the exception is raised before the logger being ready
+ // we handle the exception a la mano, but using the Logger formatting properties
+ require_once "Log/Exception.php";
+
+ $event = array();
+ $event['errno'] = $exception->getCode();
+ $event['message'] = $exception->getMessage();
+ $event['errfile'] = $exception->getFile();
+ $event['errline'] = $exception->getLine();
+ $event['backtrace'] = $exception->getTraceAsString();
+
+ $formatter = new Piwik_Log_Formatter_Exception_ScreenFormatter;
+
+ $message = $formatter->format($event);
+ $message .= "<br><br>And this exception raised another exception \"". $e->getMessage()."\"";
+
+ Piwik::exitWithErrorMessage( $message );
+ }
+}
+