Changeset 4739
- Timestamp:
- 07/28/07 07:56:12 (1 year ago)
- Files:
-
- branches/dwhittle/lib/exception/sfActionException.class.php (modified) (1 diff)
- branches/dwhittle/lib/exception/sfAutoloadException.class.php (modified) (1 diff)
- branches/dwhittle/lib/exception/sfCacheException.class.php (modified) (1 diff)
- branches/dwhittle/lib/exception/sfConfigurationException.class.php (modified) (1 diff)
- branches/dwhittle/lib/exception/sfContextException.class.php (modified) (1 diff)
- branches/dwhittle/lib/exception/sfControllerException.class.php (modified) (1 diff)
- branches/dwhittle/lib/exception/sfDatabaseException.class.php (modified) (1 diff)
- branches/dwhittle/lib/exception/sfError404Exception.class.php (modified) (1 diff)
- branches/dwhittle/lib/exception/sfException.class.php (modified) (2 diffs)
- branches/dwhittle/lib/exception/sfFactoryException.class.php (modified) (1 diff)
- branches/dwhittle/lib/exception/sfFileException.class.php (modified) (1 diff)
- branches/dwhittle/lib/exception/sfFilterException.class.php (modified) (1 diff)
- branches/dwhittle/lib/exception/sfForwardException.class.php (modified) (1 diff)
- branches/dwhittle/lib/exception/sfInitializationException.class.php (modified) (1 diff)
- branches/dwhittle/lib/exception/sfParseException.class.php (modified) (1 diff)
- branches/dwhittle/lib/exception/sfRenderException.class.php (modified) (1 diff)
- branches/dwhittle/lib/exception/sfSecurityException.class.php (modified) (1 diff)
- branches/dwhittle/lib/exception/sfStopException.class.php (modified) (1 diff)
- branches/dwhittle/lib/exception/sfStorageException.class.php (modified) (1 diff)
- branches/dwhittle/lib/exception/sfValidatorException.class.php (modified) (1 diff)
- branches/dwhittle/lib/exception/sfViewException.class.php (modified) (1 diff)
- branches/dwhittle/lib/log/sfLogger/sfConsoleLogger.class.php (copied) (copied from trunk/lib/log/sfLogger/sfConsoleLogger.class.php)
- branches/dwhittle/lib/util/sfConsoleColorizer.class.php (copied) (copied from trunk/lib/util/sfConsoleColorizer.class.php)
- branches/dwhittle/test/unit/exception/sfExceptionsTest.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/dwhittle/lib/exception/sfActionException.class.php
r3248 r4739 21 21 class sfActionException extends sfException 22 22 { 23 /**24 * Class constructor.25 *26 * @param string The error message27 * @param int The error code28 */29 public function __construct($message = null, $code = 0)30 {31 $this->setName('sfActionException');32 parent::__construct($message, $code);33 }34 23 } branches/dwhittle/lib/exception/sfAutoloadException.class.php
r3248 r4739 21 21 class sfAutoloadException extends sfException 22 22 { 23 /**24 * Class constructor.25 *26 * @param string The error message27 * @param int The error code28 */29 public function __construct($message = null, $code = 0)30 {31 $this->setName('sfAutoloadException');32 parent::__construct($message, $code);33 }34 23 } branches/dwhittle/lib/exception/sfCacheException.class.php
r3248 r4739 21 21 class sfCacheException extends sfException 22 22 { 23 /**24 * Class constructor.25 *26 * @param string The error message27 * @param int The error code28 */29 public function __construct($message = null, $code = 0)30 {31 $this->setName('sfCacheException');32 parent::__construct($message, $code);33 }34 23 } branches/dwhittle/lib/exception/sfConfigurationException.class.php
r3248 r4739 22 22 class sfConfigurationException extends sfException 23 23 { 24 /**25 * Class constructor.26 *27 * @param string The error message28 * @param int The error code29 */30 public function __construct($message = null, $code = 0)31 {32 $this->setName('sfConfigurationException');33 parent::__construct($message, $code);34 }35 24 } branches/dwhittle/lib/exception/sfContextException.class.php
r3248 r4739 20 20 class sfContextException extends sfException 21 21 { 22 /**23 * Class constructor.24 *25 * @param string The error message26 * @param int The error code27 */28 public function __construct($message = null, $code = 0)29 {30 parent::__construct($message, $code);31 $this->setName('sfContextException');32 }33 22 } branches/dwhittle/lib/exception/sfControllerException.class.php
r3248 r4739 22 22 class sfControllerException extends sfException 23 23 { 24 /**25 * Class constructor.26 *27 * @param string The error message28 * @param int The error code29 */30 public function __construct($message = null, $code = 0)31 {32 $this->setName('sfControllerException');33 parent::__construct($message, $code);34 }35 24 } branches/dwhittle/lib/exception/sfDatabaseException.class.php
r3248 r4739 21 21 class sfDatabaseException extends sfException 22 22 { 23 /**24 * Class constructor.25 *26 * @param string The error message27 * @param int The error code28 */29 public function __construct($message = null, $code = 0)30 {31 $this->setName('sfDatabaseException');32 parent::__construct($message, $code);33 }34 23 } branches/dwhittle/lib/exception/sfError404Exception.class.php
r4309 r4739 20 20 { 21 21 /** 22 * Class constructor.23 *24 * @param string The error message25 * @param int The error code26 */27 public function __construct($message = null, $code = 0)28 {29 $this->setName('sfError404Exception');30 parent::__construct($message, $code);31 }32 33 /**34 22 * Forwards to the 404 action. 35 23 * branches/dwhittle/lib/exception/sfException.class.php
r3248 r4739 34 34 public function __construct($message = null, $code = 0) 35 35 { 36 if ($this->getName() === null)37 {38 $this->setName('sfException');39 }40 41 36 parent::__construct($message, $code); 42 37 43 if (sfConfig::get('sf_logging_enabled') && $this->getName() != 'sfStopException') 44 { 45 sfLogger::getInstance()->err('{'.$this->getName().'} '.$message); 46 } 47 } 48 49 /** 50 * Retrieves the name of this exception. 51 * 52 * @return string This exception's name 53 */ 54 public function getName() 55 { 56 return $this->name; 38 if (sfConfig::get('sf_logging_enabled') && __CLASS__ != 'sfStopException') 39 { 40 sfLogger::getInstance()->err(sprintf('{%s} %s', __CLASS__, $message)); 41 } 57 42 } 58 43 … … 70 55 71 56 // don't print message if it is an sfStopException exception 72 if ( method_exists($exception, 'getName') && $exception->getName() == 'sfStopException')57 if (get_class($exception) == 'sfStopException') 73 58 { 74 59 if (!sfConfig::get('sf_test')) branches/dwhittle/lib/exception/sfFactoryException.class.php
r3248 r4739 22 22 class sfFactoryException extends sfException 23 23 { 24 /**25 * Class constructor.26 *27 * @param string The error message28 * @param int The error code29 */30 public function __construct($message = null, $code = 0)31 {32 $this->setName('sfFactoryException');33 parent::__construct($message, $code);34 }35 24 } branches/dwhittle/lib/exception/sfFileException.class.php
r3248 r4739 21 21 class sfFileException extends sfException 22 22 { 23 /**24 * Class constructor.25 *26 * @param string The error message27 * @param int The error code28 */29 public function __construct($message = null, $code = 0)30 {31 $this->setName('sfFileException');32 parent::__construct($message, $code);33 }34 23 } branches/dwhittle/lib/exception/sfFilterException.class.php
r3248 r4739 22 22 class sfFilterException extends sfException 23 23 { 24 /**25 * Class constructor.26 *27 * @param string The error message28 * @param int The error code29 */30 public function __construct($message = null, $code = 0)31 {32 $this->setName('sfFilterException');33 parent::__construct($message, $code);34 }35 24 } branches/dwhittle/lib/exception/sfForwardException.class.php
r3248 r4739 22 22 class sfForwardException extends sfException 23 23 { 24 /**25 * Class constructor.26 *27 * @param string The error message28 * @param int The error code29 */30 public function __construct($message = null, $code = 0)31 {32 $this->setName('sfForwardException');33 parent::__construct($message, $code);34 }35 24 } branches/dwhittle/lib/exception/sfInitializationException.class.php
r3248 r4739 21 21 class sfInitializationException extends sfException 22 22 { 23 /**24 * Class constructor.25 *26 * @param string The error message27 * @param int The error code28 */29 public function __construct($message = null, $code = 0)30 {31 $this->setName('sfInitializationException');32 parent::__construct($message, $code);33 }34 23 } branches/dwhittle/lib/exception/sfParseException.class.php
r3248 r4739 22 22 class sfParseException extends sfException 23 23 { 24 /**25 * Class constructor.26 *27 * @param string The error message28 * @param int The error code29 */30 public function __construct($message = null, $code = 0)31 {32 $this->setName('sfParseException');33 parent::__construct($message, $code);34 }35 24 } branches/dwhittle/lib/exception/sfRenderException.class.php
r3248 r4739 21 21 class sfRenderException extends sfException 22 22 { 23 /**24 * Class constructor.25 *26 * @param string The error message27 * @param int The error code28 */29 public function __construct($message = null, $code = 0)30 {31 $this->setName('sfRenderException');32 parent::__construct($message, $code);33 }34 23 } branches/dwhittle/lib/exception/sfSecurityException.class.php
r3248 r4739 21 21 class sfSecurityException extends sfException 22 22 { 23 /**24 * Class constructor.25 *26 * @param string The error message27 * @param int The error code28 */29 public function __construct($message = null, $code = 0)30 {31 $this->setName('sfSecurityException');32 parent::__construct($message, $code);33 }34 23 } branches/dwhittle/lib/exception/sfStopException.class.php
r3248 r4739 20 20 { 21 21 /** 22 * Class constructor.23 *24 * @param string The error message25 * @param int The error code26 */27 public function __construct($message = null, $code = 0)28 {29 $this->setName('sfStopException');30 31 // disable xdebug to avoid backtrace in error log32 if (function_exists('xdebug_disable'))33 {34 xdebug_disable();35 }36 37 parent::__construct($message, $code);38 }39 40 /**41 22 * Stops the current action. 42 23 */ branches/dwhittle/lib/exception/sfStorageException.class.php
r3248 r4739 22 22 class sfStorageException extends sfException 23 23 { 24 /**25 * Class constructor.26 *27 * @param string The error message28 * @param int The error code29 */30 public function __construct($message = null, $code = 0)31 {32 $this->setName('sfStorageException');33 parent::__construct($message, $code);34 }35 24 } branches/dwhittle/lib/exception/sfValidatorException.class.php
r3248 r4739 21 21 class sfValidatorException extends sfException 22 22 { 23 /**24 * Class constructor.25 *26 * @param string The error message27 * @param int The error code28 */29 public function __construct($message = null, $code = 0)30 {31 $this->setName('sfValidatorException');32 parent::__construct($message, $code);33 }34 23 } branches/dwhittle/lib/exception/sfViewException.class.php
r3248 r4739 21 21 class sfViewException extends sfException 22 22 { 23 /**24 * Class constructor.25 *26 * @param string The error message27 * @param int The error code28 */29 public function __construct($message = null, $code = 0)30 {31 $this->setName('sfViewException');32 parent::__construct($message, $code);33 }34 23 } branches/dwhittle/test/unit/exception/sfExceptionsTest.php
r2277 r4739 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test( 40, new lime_output_color());13 $t = new lime_test(20, new lime_output_color()); 14 14 15 15 foreach (array( … … 21 21 $class = sprintf('sf%sException', ucfirst($class)); 22 22 $e = new $class(); 23 $t->is($e->getName(), $class, sprintf('"%s" exception name is "%s"', $class, $class)); 24 $t->is(get_parent_class($e), 'sfException', sprintf('"%s" inherits from sfException', $class)); 23 $t->ok($e instanceof sfException, sprintf('"%s" inherits from sfException', $class)); 25 24 }