Adding a base HttpException for all the various HttpExceptions that cake provides, this should make it easier to write concise catch blocks.

This commit is contained in:
mark_story 2010-12-11 13:38:09 -05:00
parent 60ada4432a
commit 6c0efb62e7

View file

@ -19,12 +19,21 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* Parent class for all of the HTTP related exceptions in CakePHP.
* All HTTP status/error related exceptions should extend this class so
* catch blocks can be specifically typed.
*
* @package cake.libs
*/
class HttpException extends RuntimeException { }
/**
* Represents an HTTP 400 error.
*
* @package cake.libs
*/
class BadRequestException extends RuntimeException {
class BadRequestException extends HttpException {
/**
* Constructor
*
@ -44,7 +53,7 @@ class BadRequestException extends RuntimeException {
*
* @package cake.libs
*/
class UnauthorizedException extends RuntimeException {
class UnauthorizedException extends HttpException {
/**
* Constructor
*
@ -64,7 +73,7 @@ class UnauthorizedException extends RuntimeException {
*
* @package cake.libs
*/
class ForbiddenException extends RuntimeException {
class ForbiddenException extends HttpException {
/**
* Constructor
*
@ -84,7 +93,7 @@ class ForbiddenException extends RuntimeException {
*
* @package cake.libs
*/
class NotFoundException extends RuntimeException {
class NotFoundException extends HttpException {
/**
* Constructor
*
@ -104,7 +113,7 @@ class NotFoundException extends RuntimeException {
*
* @package cake.libs
*/
class MethodNotAllowedException extends RuntimeException {
class MethodNotAllowedException extends HttpException {
/**
* Constructor
*
@ -124,7 +133,7 @@ class MethodNotAllowedException extends RuntimeException {
*
* @package cake.libs
*/
class InternalErrorException extends CakeException {
class InternalErrorException extends HttpException {
/**
* Constructor
*