UIException.class.php (745B)
1 <?php 2 3 namespace util\exception; 4 use Exception; 5 6 class UIException extends Exception 7 { 8 public $key; 9 10 public $params; 11 12 // Die Exception neu definieren, damit die Mitteilung nicht optional ist 13 public function __construct($key, $message, $params, Exception $previous = null) 14 { 15 16 $this->key = $key; 17 $this->params = $params; 18 19 // sicherstellen, dass alles korrekt zugewiesen wird 20 parent::__construct($message, 0, $previous); 21 } 22 23 // maßgeschneiderte Stringdarstellung des Objektes 24 public function __toString() 25 { 26 return __CLASS__ . ": " . $this->key . ": '{$this->message}' in {$this->file}({$this->line})\n" 27 . "{$this->getTraceAsString()}\n".($this->getPrevious()?'Caused by: '.$this->getPrevious()->__toString():''); 28 } 29 30 } 31 32 33 ?>