Changeset 1089
- Timestamp:
- 11/29/07 19:12:31 (9 months ago)
- Files:
-
- trunk/examples/docroot/core/exception.php (modified) (2 diffs)
- trunk/src/main/php/net/stubbles/lang/stubMode.php (modified) (2 diffs)
- trunk/src/main/php/net/stubbles/util/errorhandler/stubAbstractExceptionHandler.php (added)
- trunk/src/main/php/net/stubbles/util/errorhandler/stubDisplayExceptionHandler.php (added)
- trunk/src/main/php/net/stubbles/util/errorhandler/stubExceptionHandler.php (added)
- trunk/src/main/php/net/stubbles/util/errorhandler/stubProdModeExceptionHandler.php (added)
- trunk/src/main/php/net/stubbles/util/stubExceptionHandler.php (deleted)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/examples/docroot/core/exception.php
r744 r1089 1 1 <?php 2 2 require '../bootstrap-stubbles.php'; 3 stubClassLoader::load('net.stubbles.util.stubExceptionHandler', 3 stubClassLoader::load('net.stubbles.util.errorhandler.stubProdModeExceptionHandler', 4 'net.stubbles.util.errorhandler.stubDisplayExceptionHandler', 4 5 'net.stubbles.util.stubRegistry' 5 6 ); … … 8 9 public static function main() 9 10 { 10 if (isset($_GET['test']) == true) {11 stubRegistry::setConfig('net.stubbles.mode', 'test');11 if (isset($_GET['test']) === true) { 12 $exceptionHandler = new stubDisplayExceptionHandler(); 12 13 echo '<pre>'; 14 } else { 15 $exceptionHandler = new stubProdModeExceptionHandler(); 13 16 } 14 17 15 stubExceptionHandler::register(); 18 $exceptionHandler->setLogging(false); 19 set_exception_handler(array($exceptionHandler, 'handleException')); 16 20 throw new stubException('This is an exception'); 17 21 echo 'This will never be displayed.'; trunk/src/main/php/net/stubbles/lang/stubMode.php
r1050 r1089 15 15 * or not. Currently, there are four different modes available: 16 16 * stubMode::$PROD 17 * - uses default exception handler net.stubbles.util.stubExceptionHandler17 * - uses exception handler net::stubbles::util::errorhandler::stubProdModeExceptionHandler 18 18 * - uses default error handler net.stubbles.util.errorhandler.stubDefaultErrorHandler 19 19 * - caching enabled 20 20 * stubMode::$TEST 21 * - no exception handler and no error handler 21 * - uses exception handler net::stubbles::util::errorhandler::stubDisplayExceptionHandler 22 * - no error handler 22 23 * - caching enabled 23 24 * stubMode::$STAGE 24 * - no exception handler and no error handler 25 * - uses exception handler net::stubbles::util::errorhandler::stubDisplayExceptionHandler 26 * - no error handler 25 27 * - caching disabled 26 28 * stubMode::$DEV 27 * - no exception handler and no error handler 29 * - uses exception handler net::stubbles::util::errorhandler::stubDisplayExceptionHandler 30 * - no error handler 28 31 * - caching disabled 29 32 * While stage and dev mode currently are not different this may change in … … 91 94 public static function __static() 92 95 { 93 self::$PROD = new self('PROD', 0); 94 self::$PROD->exceptionHandler = array('class' => 'net.stubbles.util.stubExceptionHandler', 95 'method' => 'handle' 96 ); 97 self::$PROD->errorHandler = array('class' => 'net.stubbles.util.errorhandler.stubDefaultErrorHandler', 98 'method' => 'handle' 99 ); 100 self::$TEST = new self('TEST', 1); 101 self::$STAGE = new self('STAGE', 2); 102 self::$STAGE->enableCache = false; 103 self::$DEV = new self('STAGE', 3); 104 self::$DEV->enableCache = false; 96 self::$PROD = new self('PROD', 0); 97 self::$PROD->exceptionHandler = array('class' => 'net.stubbles.util.errorhandler.stubProdModeExceptionHandler', 98 'method' => 'handle' 99 ); 100 self::$PROD->errorHandler = array('class' => 'net.stubbles.util.errorhandler.stubDefaultErrorHandler', 101 'method' => 'handle' 102 ); 103 self::$TEST = new self('TEST', 1); 104 self::$TEST->exceptionHandler = array('class' => 'net.stubbles.util.errorhandler.stubDisplayExceptionHandler', 105 'method' => 'handle' 106 ); 107 self::$STAGE = new self('STAGE', 2); 108 self::$STAGE->exceptionHandler = array('class' => 'net.stubbles.util.errorhandler.stubDisplayExceptionHandler', 109 'method' => 'handle' 110 ); 111 self::$STAGE->enableCache = false; 112 self::$DEV = new self('STAGE', 3); 113 self::$DEV->exceptionHandler = array('class' => 'net.stubbles.util.errorhandler.stubDisplayExceptionHandler', 114 'method' => 'handle' 115 ); 116 self::$DEV->enableCache = false; 105 117 } 106 118
