From ffa5c1e86e578ff166d5c55a5edb1ca14f1e3d28 Mon Sep 17 00:00:00 2001 From: Thomas Steur Date: Tue, 4 Nov 2014 03:31:50 +0100 Subject: refs #6564 refactored out HtmlMessageException and introduced some other exceptions instead --- core/FrontController.php | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'core/FrontController.php') diff --git a/core/FrontController.php b/core/FrontController.php index 0fa143d4b6..ea33c4e8f2 100644 --- a/core/FrontController.php +++ b/core/FrontController.php @@ -12,7 +12,7 @@ namespace Piwik; use Exception; use Piwik\API\Request; use Piwik\API\ResponseBuilder; -use Piwik\Exceptions\HtmlMessageException; +use Piwik\Exception\AuthenticationFailedException; use Piwik\Http\Router; use Piwik\Plugin\Controller; use Piwik\Plugin\Report; @@ -419,10 +419,15 @@ class FrontController extends Singleton try { $authAdapter = Registry::get('auth'); } catch (Exception $e) { - throw new HtmlMessageException("Authentication object cannot be found in the Registry. Maybe the Login plugin is not activated? -
You can activate the plugin by adding:
- Plugins[] = Login
- under the [Plugins] section in your config/config.ini.php"); + $message = "Authentication object cannot be found in the Registry. Maybe the Login plugin is not activated? +
You can activate the plugin by adding:
+ Plugins[] = Login
+ under the [Plugins] section in your config/config.ini.php"; + + $ex = new AuthenticationFailedException($message); + $ex->setIsHtmlMessage(); + + throw $ex; } Access::getInstance()->reloadAccess($authAdapter); @@ -613,10 +618,10 @@ class FrontController extends Singleton { $debugTrace = $ex->getTraceAsString(); - if (method_exists($ex, 'getHtmlMessage')) { - $message = $ex->getHtmlMessage(); - } else { - $message = Common::sanitizeInputValue($ex->getMessage()); + $message = $ex->getMessage(); + + if (!method_exists($ex, 'isHtmlMessage') || !$ex->isHtmlMessage()) { + $message = Common::sanitizeInputValue($message); } $logo = new CustomLogo(); -- cgit v1.2.3