3 * Throwable exceptions to return HTTP status code
5 * This list of Exception has be extracted from
6 * here http://racksburg.com/choosing-an-http-status-code/
9 class HTTPException extends Exception {
12 public function __construct($message="", $code = 0, Exception $previous = null) {
13 if ($this->httpdesc=="") {
14 $this->httpdesc = preg_replace("|([a-z])([A-Z])|",'$1 $2', str_replace("Exception","",get_class($this)));
16 parent::__construct($message, $code, $previous);
21 class TooManyRequestsException extends HTTPException {
25 class UnauthorizedException extends HTTPException {
29 class ForbiddenException extends HTTPException {
33 class NotFoundException extends HTTPException {
37 class GoneException extends HTTPException {
41 class MethodNotAllowedException extends HTTPException {
45 class NonAcceptableException extends HTTPException {
49 class LenghtRequiredException extends HTTPException {
53 class PreconditionFailedException extends HTTPException {
57 class UnsupportedMediaTypeException extends HTTPException {
61 class ExpetationFailesException extends HTTPException {
65 class ConflictException extends HTTPException {
69 class UnprocessableEntityException extends HTTPException {
73 class ImATeapotException extends HTTPException {
75 var $httpdesc = "I'm A Teapot";
78 class BadRequestException extends HTTPException {
84 class ServiceUnavaiableException extends HTTPException {
88 class BadGatewayException extends HTTPException {
92 class GatewayTimeoutException extends HTTPException {
96 class NotImplementedException extends HTTPException {
100 class InternalServerErrorException extends HTTPException {