sddns/include/exceptions.php
2010-08-17 01:23:57 +02:00

26 lines
758 B
PHP
Executable file

<?php
class UserException extends CustomException {}
class ValidationException extends UserException {}
class NameServerException extends CustomException {}
class CustomException extends Exception {
public function toXml(DOMDocument $doc) {
$xmlRecord = $doc->createElement('exception');
$xmlRecord->setAttribute('code', $this->code);
$xmlRecord->appendChild($doc->createElement('message', $this->message));
$xmlRecord->appendChild($doc->createElement('line', $this->line));
$xmlRecord->appendChild($doc->createElement('file', $this->file));
$xmlRecord->appendChild(backtrace2xml($this->getTrace(), $doc));
return $xmlRecord;
}
public function toHtml() {
return $this->message . ' in ' . $this->file . ':' . $this->line;
}
}
?>