Fix coding standard issues in Error/

This commit is contained in:
mark_story 2012-03-03 19:46:15 -05:00
parent 63c992a85b
commit 60989ad6c8
3 changed files with 75 additions and 11 deletions

View file

@ -224,4 +224,5 @@ class ErrorHandler {
} }
return array($error, $log); return array($error, $log);
} }
} }

View file

@ -203,7 +203,7 @@ class ExceptionRenderer {
$this->controller->set(array( $this->controller->set(array(
'name' => $message, 'name' => $message,
'url' => h($url), 'url' => h($url),
'error' => $error, 'error' => $error,
'_serialize' => array('name', 'url') '_serialize' => array('name', 'url')
)); ));
$this->_outputMessage('error400'); $this->_outputMessage('error400');
@ -286,4 +286,5 @@ class ExceptionRenderer {
$this->controller->response->type('html'); $this->controller->response->type('html');
$this->controller->response->send(); $this->controller->response->send();
} }
} }

View file

@ -26,7 +26,8 @@
* @package Cake.Error * @package Cake.Error
*/ */
if (!class_exists('HttpException')) { if (!class_exists('HttpException')) {
class HttpException extends RuntimeException { } class HttpException extends RuntimeException {
}
} }
/** /**
@ -35,6 +36,7 @@ if (!class_exists('HttpException')) {
* @package Cake.Error * @package Cake.Error
*/ */
class BadRequestException extends HttpException { class BadRequestException extends HttpException {
/** /**
* Constructor * Constructor
* *
@ -47,6 +49,7 @@ class BadRequestException extends HttpException {
} }
parent::__construct($message, $code); parent::__construct($message, $code);
} }
} }
/** /**
@ -55,6 +58,7 @@ class BadRequestException extends HttpException {
* @package Cake.Error * @package Cake.Error
*/ */
class UnauthorizedException extends HttpException { class UnauthorizedException extends HttpException {
/** /**
* Constructor * Constructor
* *
@ -67,6 +71,7 @@ class UnauthorizedException extends HttpException {
} }
parent::__construct($message, $code); parent::__construct($message, $code);
} }
} }
/** /**
@ -75,6 +80,7 @@ class UnauthorizedException extends HttpException {
* @package Cake.Error * @package Cake.Error
*/ */
class ForbiddenException extends HttpException { class ForbiddenException extends HttpException {
/** /**
* Constructor * Constructor
* *
@ -87,6 +93,7 @@ class ForbiddenException extends HttpException {
} }
parent::__construct($message, $code); parent::__construct($message, $code);
} }
} }
/** /**
@ -95,6 +102,7 @@ class ForbiddenException extends HttpException {
* @package Cake.Error * @package Cake.Error
*/ */
class NotFoundException extends HttpException { class NotFoundException extends HttpException {
/** /**
* Constructor * Constructor
* *
@ -107,6 +115,7 @@ class NotFoundException extends HttpException {
} }
parent::__construct($message, $code); parent::__construct($message, $code);
} }
} }
/** /**
@ -115,6 +124,7 @@ class NotFoundException extends HttpException {
* @package Cake.Error * @package Cake.Error
*/ */
class MethodNotAllowedException extends HttpException { class MethodNotAllowedException extends HttpException {
/** /**
* Constructor * Constructor
* *
@ -127,6 +137,7 @@ class MethodNotAllowedException extends HttpException {
} }
parent::__construct($message, $code); parent::__construct($message, $code);
} }
} }
/** /**
@ -135,6 +146,7 @@ class MethodNotAllowedException extends HttpException {
* @package Cake.Error * @package Cake.Error
*/ */
class InternalErrorException extends HttpException { class InternalErrorException extends HttpException {
/** /**
* Constructor * Constructor
* *
@ -147,6 +159,7 @@ class InternalErrorException extends HttpException {
} }
parent::__construct($message, $code); parent::__construct($message, $code);
} }
} }
/** /**
@ -156,6 +169,7 @@ class InternalErrorException extends HttpException {
* @package Cake.Error * @package Cake.Error
*/ */
class CakeException extends RuntimeException { class CakeException extends RuntimeException {
/** /**
* Array of attributes that are passed in from the constructor, and * Array of attributes that are passed in from the constructor, and
* made available in the view when a development error is displayed. * made available in the view when a development error is displayed.
@ -197,6 +211,7 @@ class CakeException extends RuntimeException {
public function getAttributes() { public function getAttributes() {
return $this->_attributes; return $this->_attributes;
} }
} }
/** /**
@ -206,11 +221,13 @@ class CakeException extends RuntimeException {
* @package Cake.Error * @package Cake.Error
*/ */
class MissingControllerException extends CakeException { class MissingControllerException extends CakeException {
protected $_messageTemplate = 'Controller class %s could not be found.'; protected $_messageTemplate = 'Controller class %s could not be found.';
public function __construct($message, $code = 404) { public function __construct($message, $code = 404) {
parent::__construct($message, $code); parent::__construct($message, $code);
} }
} }
/** /**
@ -220,11 +237,13 @@ class MissingControllerException extends CakeException {
* @package Cake.Error * @package Cake.Error
*/ */
class MissingActionException extends CakeException { class MissingActionException extends CakeException {
protected $_messageTemplate = 'Action %s::%s() could not be found.'; protected $_messageTemplate = 'Action %s::%s() could not be found.';
public function __construct($message, $code = 404) { public function __construct($message, $code = 404) {
parent::__construct($message, $code); parent::__construct($message, $code);
} }
} }
/** /**
@ -234,11 +253,13 @@ class MissingActionException extends CakeException {
* @package Cake.Error * @package Cake.Error
*/ */
class PrivateActionException extends CakeException { class PrivateActionException extends CakeException {
protected $_messageTemplate = 'Private Action %s::%s() is not directly accessible.'; protected $_messageTemplate = 'Private Action %s::%s() is not directly accessible.';
public function __construct($message, $code = 404, Exception $previous = null) { public function __construct($message, $code = 404, Exception $previous = null) {
parent::__construct($message, $code, $previous); parent::__construct($message, $code, $previous);
} }
} }
/** /**
@ -247,7 +268,9 @@ class PrivateActionException extends CakeException {
* @package Cake.Error * @package Cake.Error
*/ */
class MissingComponentException extends CakeException { class MissingComponentException extends CakeException {
protected $_messageTemplate = 'Component class %s could not be found.'; protected $_messageTemplate = 'Component class %s could not be found.';
} }
/** /**
@ -256,7 +279,9 @@ class MissingComponentException extends CakeException {
* @package Cake.Error * @package Cake.Error
*/ */
class MissingBehaviorException extends CakeException { class MissingBehaviorException extends CakeException {
protected $_messageTemplate = 'Behavior class %s could not be found.'; protected $_messageTemplate = 'Behavior class %s could not be found.';
} }
/** /**
@ -265,7 +290,9 @@ class MissingBehaviorException extends CakeException {
* @package Cake.Error * @package Cake.Error
*/ */
class MissingViewException extends CakeException { class MissingViewException extends CakeException {
protected $_messageTemplate = 'View file "%s" is missing.'; protected $_messageTemplate = 'View file "%s" is missing.';
} }
/** /**
@ -274,7 +301,9 @@ class MissingViewException extends CakeException {
* @package Cake.Error * @package Cake.Error
*/ */
class MissingLayoutException extends CakeException { class MissingLayoutException extends CakeException {
protected $_messageTemplate = 'Layout file "%s" is missing.'; protected $_messageTemplate = 'Layout file "%s" is missing.';
} }
/** /**
@ -283,7 +312,9 @@ class MissingLayoutException extends CakeException {
* @package Cake.Error * @package Cake.Error
*/ */
class MissingHelperException extends CakeException { class MissingHelperException extends CakeException {
protected $_messageTemplate = 'Helper class %s could not be found.'; protected $_messageTemplate = 'Helper class %s could not be found.';
} }
/** /**
@ -292,7 +323,9 @@ class MissingHelperException extends CakeException {
* @package Cake.Error * @package Cake.Error
*/ */
class MissingDatabaseException extends CakeException { class MissingDatabaseException extends CakeException {
protected $_messageTemplate = 'Database connection "%s" could not be found.'; protected $_messageTemplate = 'Database connection "%s" could not be found.';
} }
/** /**
@ -301,7 +334,9 @@ class MissingDatabaseException extends CakeException {
* @package Cake.Error * @package Cake.Error
*/ */
class MissingConnectionException extends CakeException { class MissingConnectionException extends CakeException {
protected $_messageTemplate = 'Database connection "%s" is missing, or could not be created.'; protected $_messageTemplate = 'Database connection "%s" is missing, or could not be created.';
} }
/** /**
@ -310,7 +345,9 @@ class MissingConnectionException extends CakeException {
* @package Cake.Error * @package Cake.Error
*/ */
class MissingTaskException extends CakeException { class MissingTaskException extends CakeException {
protected $_messageTemplate = 'Task class %s could not be found.'; protected $_messageTemplate = 'Task class %s could not be found.';
} }
/** /**
@ -319,7 +356,9 @@ class MissingTaskException extends CakeException {
* @package Cake.Error * @package Cake.Error
*/ */
class MissingShellMethodException extends CakeException { class MissingShellMethodException extends CakeException {
protected $_messageTemplate = "Unknown command %1\$s %2\$s.\nFor usage try `cake %1\$s --help`"; protected $_messageTemplate = "Unknown command %1\$s %2\$s.\nFor usage try `cake %1\$s --help`";
} }
/** /**
@ -328,7 +367,9 @@ class MissingShellMethodException extends CakeException {
* @package Cake.Error * @package Cake.Error
*/ */
class MissingShellException extends CakeException { class MissingShellException extends CakeException {
protected $_messageTemplate = 'Shell class %s could not be found.'; protected $_messageTemplate = 'Shell class %s could not be found.';
} }
/** /**
@ -337,7 +378,9 @@ class MissingShellException extends CakeException {
* @package Cake.Error * @package Cake.Error
*/ */
class MissingDatasourceConfigException extends CakeException { class MissingDatasourceConfigException extends CakeException {
protected $_messageTemplate = 'The datasource configuration "%s" was not found in database.php'; protected $_messageTemplate = 'The datasource configuration "%s" was not found in database.php';
} }
/** /**
@ -346,7 +389,9 @@ class MissingDatasourceConfigException extends CakeException {
* @package Cake.Error * @package Cake.Error
*/ */
class MissingDatasourceException extends CakeException { class MissingDatasourceException extends CakeException {
protected $_messageTemplate = 'Datasource class %s could not be found.'; protected $_messageTemplate = 'Datasource class %s could not be found.';
} }
/** /**
@ -355,7 +400,9 @@ class MissingDatasourceException extends CakeException {
* @package Cake.Error * @package Cake.Error
*/ */
class MissingTableException extends CakeException { class MissingTableException extends CakeException {
protected $_messageTemplate = 'Table %s for model %s was not found in datasource %s.'; protected $_messageTemplate = 'Table %s for model %s was not found in datasource %s.';
} }
/** /**
@ -364,7 +411,9 @@ class MissingTableException extends CakeException {
* @package Cake.Error * @package Cake.Error
*/ */
class MissingModelException extends CakeException { class MissingModelException extends CakeException {
protected $_messageTemplate = 'Model %s could not be found.'; protected $_messageTemplate = 'Model %s could not be found.';
} }
/** /**
@ -373,7 +422,9 @@ class MissingModelException extends CakeException {
* @package Cake.Error * @package Cake.Error
*/ */
class MissingTestLoaderException extends CakeException { class MissingTestLoaderException extends CakeException {
protected $_messageTemplate = 'Test loader %s could not be found.'; protected $_messageTemplate = 'Test loader %s could not be found.';
} }
/** /**
@ -382,7 +433,9 @@ class MissingTestLoaderException extends CakeException {
* @package Cake.Error * @package Cake.Error
*/ */
class MissingPluginException extends CakeException { class MissingPluginException extends CakeException {
protected $_messageTemplate = 'Plugin %s could not be found.'; protected $_messageTemplate = 'Plugin %s could not be found.';
} }
/** /**
@ -390,7 +443,8 @@ class MissingPluginException extends CakeException {
* *
* @package Cake.Error * @package Cake.Error
*/ */
class AclException extends CakeException { } class AclException extends CakeException {
}
/** /**
* Exception class for Cache. This exception will be thrown from Cache when it * Exception class for Cache. This exception will be thrown from Cache when it
@ -398,7 +452,8 @@ class AclException extends CakeException { }
* *
* @package Cake.Error * @package Cake.Error
*/ */
class CacheException extends CakeException { } class CacheException extends CakeException {
}
/** /**
* Exception class for Router. This exception will be thrown from Router when it * Exception class for Router. This exception will be thrown from Router when it
@ -406,7 +461,8 @@ class CacheException extends CakeException { }
* *
* @package Cake.Error * @package Cake.Error
*/ */
class RouterException extends CakeException { } class RouterException extends CakeException {
}
/** /**
* Exception class for CakeLog. This exception will be thrown from CakeLog when it * Exception class for CakeLog. This exception will be thrown from CakeLog when it
@ -414,7 +470,8 @@ class RouterException extends CakeException { }
* *
* @package Cake.Error * @package Cake.Error
*/ */
class CakeLogException extends CakeException { } class CakeLogException extends CakeException {
}
/** /**
* Exception class for CakeSession. This exception will be thrown from CakeSession when it * Exception class for CakeSession. This exception will be thrown from CakeSession when it
@ -422,7 +479,8 @@ class CakeLogException extends CakeException { }
* *
* @package Cake.Error * @package Cake.Error
*/ */
class CakeSessionException extends CakeException { } class CakeSessionException extends CakeException {
}
/** /**
* Exception class for Configure. This exception will be thrown from Configure when it * Exception class for Configure. This exception will be thrown from Configure when it
@ -430,7 +488,8 @@ class CakeSessionException extends CakeException { }
* *
* @package Cake.Error * @package Cake.Error
*/ */
class ConfigureException extends CakeException { } class ConfigureException extends CakeException {
}
/** /**
* Exception class for Socket. This exception will be thrown from CakeSocket, CakeEmail, HttpSocket * Exception class for Socket. This exception will be thrown from CakeSocket, CakeEmail, HttpSocket
@ -438,7 +497,8 @@ class ConfigureException extends CakeException { }
* *
* @package Cake.Error * @package Cake.Error
*/ */
class SocketException extends CakeException { } class SocketException extends CakeException {
}
/** /**
* Exception class for Xml. This exception will be thrown from Xml when it * Exception class for Xml. This exception will be thrown from Xml when it
@ -446,7 +506,8 @@ class SocketException extends CakeException { }
* *
* @package Cake.Error * @package Cake.Error
*/ */
class XmlException extends CakeException { } class XmlException extends CakeException {
}
/** /**
* Exception class for Console libraries. This exception will be thrown from Console library * Exception class for Console libraries. This exception will be thrown from Console library
@ -454,4 +515,5 @@ class XmlException extends CakeException { }
* *
* @package Cake.Error * @package Cake.Error
*/ */
class ConsoleException extends CakeException { } class ConsoleException extends CakeException {
}