From 783f0e5a3e4738e5c396323fb551c577fd8a599e Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 14 Apr 2013 13:19:34 +0200 Subject: [PATCH] Allowing certain exceptions to ignore the debug mode --- .../lib/system/exception/LoggedException.class.php | 12 +++++++++--- .../system/exception/NamedUserException.class.php | 7 ++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/wcfsetup/install/files/lib/system/exception/LoggedException.class.php b/wcfsetup/install/files/lib/system/exception/LoggedException.class.php index 8c616f6ae8..5afa175060 100644 --- a/wcfsetup/install/files/lib/system/exception/LoggedException.class.php +++ b/wcfsetup/install/files/lib/system/exception/LoggedException.class.php @@ -7,20 +7,26 @@ use wcf\util\StringUtil; * A logged exceptions prevents information disclosures and provides an easy * way to log errors. * - * @author Tim Düsterhus, Alexander Ebert - * @copyright 2001-2012 WoltLab GmbH + * @author Tim Duesterhus, Alexander Ebert + * @copyright 2001-2013 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage system.exception * @category Community Framework */ class LoggedException extends \Exception { + /** + * ignore disabled debug mode + * @var boolean + */ + protected $ignoreDebugMode = false; + /** * @see \Exception::getMessage() */ public function _getMessage() { // suppresses the original error message - if (!WCF::debugModeIsEnabled()) { + if (!WCF::debugModeIsEnabled() && !$this->ignoreDebugMode) { return 'An error occured. Sorry.'; } diff --git a/wcfsetup/install/files/lib/system/exception/NamedUserException.class.php b/wcfsetup/install/files/lib/system/exception/NamedUserException.class.php index 228c449135..56e55861a4 100644 --- a/wcfsetup/install/files/lib/system/exception/NamedUserException.class.php +++ b/wcfsetup/install/files/lib/system/exception/NamedUserException.class.php @@ -6,13 +6,18 @@ use wcf\system\WCF; * NamedUserException shows a (well) styled page with the given error message. * * @author Marcel Werk - * @copyright 2001-2012 WoltLab GmbH + * @copyright 2001-2013 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage system.exception * @category Community Framework */ class NamedUserException extends UserException { + /** + * @see wcf\system\exception\LoggedException::$ignoreDebugMode + */ + protected $ignoreDebugMode = true; + /** * Shows a styled page with the given error message. */ -- 2.20.1