Show
Ignore:
Timestamp:
03/12/2008 10:32:25 AM (9 months ago)
Author:
Geert
Message:

Extending Exception the way it should be done. Calling parent's constructor now and got rid of magic get. http://php.net/exceptions

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/modules/unit_test/libraries/Unit_Test.php

    r2288 r2289  
    390390class Kohana_Unit_Test_Exception extends Exception { 
    391391 
    392         protected $message = ''; 
    393392        protected $debug = NULL; 
    394         protected $file = ''; 
    395         protected $line = ''; 
    396  
    397         /** 
    398          * Set exception message and debug 
     393 
     394        /** 
     395         * Sets exception message and debug info. 
    399396         * 
    400397         * @param   string  message 
     
    405402        { 
    406403                // Failure message 
    407                 $this->message = (string) $message; 
     404                parent::__construct($message); 
    408405 
    409406                // Extra user-defined debug info 
    410407                $this->debug = $debug; 
    411408 
    412                 // Retrieve failure location 
     409                // Overwrite failure location 
    413410                $trace = $this->getTrace(); 
    414411                $this->file = $trace[0]['file']; 
     
    417414 
    418415        /** 
    419          * Magically gets an object property. 
    420          * 
    421          * @param   string  property key 
    422          * @return  mixed   variable value if the key is found 
    423          * @return  void    if the key is not found 
    424          */ 
    425         public function __get($key) 
    426         { 
    427                 if (isset($this->$key)) 
    428                         return $this->$key; 
     416         * Returns the user-defined debug info 
     417         * 
     418         * @return  mixed  debug property 
     419         */ 
     420        public function getDebug() 
     421        { 
     422                return $this->debug; 
    429423        } 
    430424