You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.0 KiB
PHP

<?php
class WebException extends Exception
{
private $excname;
/**
* @param string $name
* @param string $reason
* @param int $code
*/
function __construct($name, $reason, $code)
{
$this->excname = $name;
parent::__construct($reason, $code);
}
public function getName()
{
return $this->excname;
}
}
class SqlException extends Exception
{
private $query;
public function __construct($message = "Sql Error", $query = "")
{
$this->query = $query;
parent::__construct($message, 0);
}
public function getSqlError()
{
return $this->getMessage().' while executing: '.$this->query;
}
}
class BookNotFoundException extends WebException {
public function __construct($code) {
parent::__construct('BookNotFound', "The book with code $code was not found", -404);
}
}
/**
* Exception raised when an invalid attribute name is accessed
*/
class InvalidAttributeException extends Exception { }