Files
zurawik.pl/core/class/Exception.class.php
2026-05-15 20:23:25 +02:00

163 lines
2.7 KiB
PHP

<?php
/**
* $Id: Exception.class.php 863 2008-07-08 08:05:50Z pawy $
* Obsluga wyjatkow jadra
*
*/
class CoreException extends Exception {
/**
* Backtrace
*
* @var array
*/
public $backtrace;
/**
* Konstruktor
*
* @param string $message
* @param integer $code
*/
public function __construct($message=false, $code=false) {
$this->message = $message;
$this->backtrace = debug_backtrace();
}
public function __toString() {
$out = '<br />';
$c = count($this->backtrace);
foreach($this->backtrace as $line) {
$out .= '<b>[ #'. $c.' ]</b><br /> ';
$out .= '<b>[ method ]</b>' . $line['function'] . '()<br /><b>[ file ]</b> ' . $line['file'] . ' (line: ' . $line['line'] .')<br /><br />';
$c--;
}
$out .= '<br />';
return $out;
}
}
/**
* Obsluga wyjatkow plikowych
*
*/
class FileException extends CoreException {
/**
* Backtrace
*
* @var array
*/
public $backtrace;
/**
* Konstruktor
*
* @param string $message
* @param integer $code
*/
public function __construct($message=false, $code=false) {
$this->message = $message;
$this->backtrace = debug_backtrace();
}
}
/**
* Obsluga wyjatkow mysql
*
*/
class MysqlException extends FileException {
/**
* Backtrace
*
* @var array
*/
public $backtrace;
/**
* Konstruktor
*
* @param string $message
* @param integer $code
*/
public function __construct($message=false, $code=false) {
if(!$message) {
$this->message = '';
}
else
$this->message = $message;
if(!$code) {
$this->code = 0;
}
else
$this->code = $code;
$this->backtrace = debug_backtrace();
}
}
/**
* Obsluga wyjatkow autoryzacji
*
*/
class AuthException extends MysqlException {
/**
* Backtrace
*
* @var array
*/
public $backtrace;
/**
* Konstruktor
*
* @param string $message
* @param integer $code
*/
public function __construct($message=false, $code=false) {
$this->backtrace = debug_backtrace();
}
}
/**
* Obsluga wyjatkow uzytkownika
*
*/
class UserException extends AuthException {
/**
* Backtrace
*
* @var array
*/
public $backtrace;
/**
* Konstruktor
*
* @param string $message
* @param integer $code
*/
public function __construct($message=false, $code=false) {
$this->message = $message;
$this->backtrace = debug_backtrace();
}
}
/**
* Wyjatek ApiException.
*
* @author WP
*/
class ApiException extends Exception {
}
/**
* Wyjatek SecurityException.
*
* @author WP
*/
class SecurityException extends ApiException {
}
?>