Allowing certain exceptions to ignore the debug mode
authorAlexander Ebert <ebert@woltlab.com>
Sun, 14 Apr 2013 11:19:34 +0000 (13:19 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 14 Apr 2013 11:19:34 +0000 (13:19 +0200)
wcfsetup/install/files/lib/system/exception/LoggedException.class.php
wcfsetup/install/files/lib/system/exception/NamedUserException.class.php

index 8c616f6ae858f1852c10e7c8f796673091d511c8..5afa175060ca31d61273a4f2bae9ac76352ab008 100644 (file)
@@ -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 <http://opensource.org/licenses/lgpl-license.php>
  * @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.';
                }
                
index 228c449135b49ec55982aebec83a51f13b23e35b..56e55861a42fbd080dee9062cfdc34e6fbf49f3d 100644 (file)
@@ -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 <http://opensource.org/licenses/lgpl-license.php>
  * @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.
         */