. */ /** * This file contains the generic exception class. * * @author Dinu Florin * @package Core */ /** * Generic exception class. * Throw and extend this exception instead of the native one. * * @author Dinu Florin * @package Core */ class GenericException extends Exception { protected $message = 'GenericException'; /** * The constructor. * * @param string $message The message to be displayed (default = "Unknown Exception") */ public function __construct($message='Unknown Exception') { $this->message = $message; parent::__construct($this->message, 0); } /** * Get debug trace. * This is meant to be overriden by other exception types to provide a custom debug message and stack trace. */ public function getDebugTrace() { return $this->getTraceAsString(); } /** * __toString() * * @return string. */ final public function __toString() { if(defined('DEBUG') && DEBUG) { return get_class($this).': '.$this->message."\n".$this->getDebugTrace(); } else return $this->message; } } ?>