From 5c2669513e8561ce2f62aa08c37ef806e43001d7 Mon Sep 17 00:00:00 2001 From: Matthieu Napoli Date: Thu, 11 Dec 2014 14:37:53 +1300 Subject: #6622 Logger refactoring: Separated error and exception handling from logging - the error handler logs warnings and notices, and turns errors into exceptions (`ErrorException`) - the exception handler catches all uncatched exceptions and display them to the user (HTML or CLI) - the "screen" logging backend has been removed - I've normalized exceptions/errors shown to the user in HTML (wether they are catched by the FrontController or not) --- core/FrontController.php | 45 --------------------------------------------- 1 file changed, 45 deletions(-) (limited to 'core/FrontController.php') diff --git a/core/FrontController.php b/core/FrontController.php index 7d1702315f..d536ab22a7 100644 --- a/core/FrontController.php +++ b/core/FrontController.php @@ -18,7 +18,6 @@ use Piwik\Http\Router; use Piwik\Plugin\Controller; use Piwik\Plugin\Report; use Piwik\Plugin\Widgets; -use Piwik\Plugins\CoreAdminHome\CustomLogo; use Piwik\Session; /** @@ -610,48 +609,4 @@ class FrontController extends Singleton Piwik::postEvent('Request.dispatch.end', array(&$result, $module, $action, $parameters)); return $result; } - - /** - * Returns HTML that displays an exception's error message (and possibly stack trace). - * The result of this method is echo'd by dispatch.php. - * - * @param Exception $ex The exception to use when generating the error page's HTML. - * @return string The HTML to echo. - */ - public function getErrorResponse(Exception $ex) - { - $debugTrace = $ex->getTraceAsString(); - - $message = $ex->getMessage(); - - if (!method_exists($ex, 'isHtmlMessage') || !$ex->isHtmlMessage()) { - $message = Common::sanitizeInputValue($message); - } - - $logo = new CustomLogo(); - - $logoHeaderUrl = false; - $logoFaviconUrl = false; - try { - $logoHeaderUrl = $logo->getHeaderLogoUrl(); - $logoFaviconUrl = $logo->getPathUserFavicon(); - } catch (Exception $ex) { - Log::debug($ex); - } - - $result = Piwik_GetErrorMessagePage($message, $debugTrace, true, true, $logoHeaderUrl, $logoFaviconUrl); - - /** - * Triggered before a Piwik error page is displayed to the user. - * - * This event can be used to modify the content of the error page that is displayed when - * an exception is caught. - * - * @param string &$result The HTML of the error page. - * @param Exception $ex The Exception displayed in the error page. - */ - Piwik::postEvent('FrontController.modifyErrorPage', array(&$result, $ex)); - - return $result; - } } -- cgit v1.2.3