diff options
author | mattab <matthieu.aubry@gmail.com> | 2013-03-28 03:42:39 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2013-03-28 03:42:40 +0400 |
commit | ae4b03163792f0b6e933933e5d37df87dc3fd566 (patch) | |
tree | d1d7510a9728f587d3d63ebd03e4ecf3d904838b /core/ExceptionHandler.php | |
parent | 158c2150f5f2e13ece459b8d131244c11b763997 (diff) |
Mass conversion of all files to the newly agreed coding standard: PSR 1/2
Converting Piwik core source files, PHP, JS, TPL, CSS
More info: http://piwik.org/participate/coding-standards/
Diffstat (limited to 'core/ExceptionHandler.php')
-rw-r--r-- | core/ExceptionHandler.php | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/core/ExceptionHandler.php b/core/ExceptionHandler.php index 7bae1057b2..b3dd6692fe 100644 --- a/core/ExceptionHandler.php +++ b/core/ExceptionHandler.php @@ -1,10 +1,10 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * + * * @category Piwik * @package Piwik */ @@ -12,34 +12,33 @@ /** * Exception handler used to display nicely exceptions in Piwik * - * @param Exception $exception + * @param Exception $exception * @throws Exception */ -function Piwik_ExceptionHandler(Exception $exception) +function Piwik_ExceptionHandler(Exception $exception) { - try { - Zend_Registry::get('logger_exception')->logEvent($exception); - } catch(Exception $e) { - - if(Piwik_FrontController::shouldRethrowException()) - { - throw $exception; - } - - // case when the exception is raised before the logger being ready - // we handle the exception a la mano, but using the Logger formatting properties - $event = array(); - $event['errno'] = $exception->getCode(); - $event['message'] = $exception->getMessage(); - $event['errfile'] = $exception->getFile(); - $event['errline'] = $exception->getLine(); - $event['backtrace'] = $exception->getTraceAsString(); + try { + Zend_Registry::get('logger_exception')->logEvent($exception); + } catch (Exception $e) { + + if (Piwik_FrontController::shouldRethrowException()) { + throw $exception; + } + + // case when the exception is raised before the logger being ready + // we handle the exception a la mano, but using the Logger formatting properties + $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_Exception_Formatter_ScreenFormatter(); + + $message = $formatter->format($event); + $message .= "<br /><br />And this exception raised another exception \"" . $e->getMessage() . "\""; - $formatter = new Piwik_Log_Exception_Formatter_ScreenFormatter(); - - $message = $formatter->format($event); - $message .= "<br /><br />And this exception raised another exception \"". $e->getMessage()."\""; - - Piwik::exitWithErrorMessage( $message ); - } + Piwik::exitWithErrorMessage($message); + } } |