|
|
@@ -19,6 +19,43 @@
|
|
|
*/
|
|
|
|
|
|
/**
|
|
|
+ * Base class that all Exceptions extend.
|
|
|
+ *
|
|
|
+ * @package Cake.Error
|
|
|
+ */
|
|
|
+class CakeBaseException extends RuntimeException {
|
|
|
+
|
|
|
+/**
|
|
|
+ * Array of headers to be passed to CakeResponse::header()
|
|
|
+ *
|
|
|
+ * @var array
|
|
|
+ */
|
|
|
+ protected $_responseHeaders = null;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Get/set the response header to be used
|
|
|
+ *
|
|
|
+ * See also CakeResponse::header()
|
|
|
+ *
|
|
|
+ * @param string|array $header. An array of header strings or a single header string
|
|
|
+ * - an associative array of "header name" => "header value"
|
|
|
+ * - an array of string headers is also accepted
|
|
|
+ * @param string $value. The header value.
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function responseHeader($header = null, $value = null) {
|
|
|
+ if ($header) {
|
|
|
+ if (is_array($header)) {
|
|
|
+ return $this->_responseHeaders = $header;
|
|
|
+ }
|
|
|
+ $this->_responseHeaders = array($header => $value);
|
|
|
+ }
|
|
|
+ return $this->_responseHeaders;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
* 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.
|
|
|
@@ -26,7 +63,7 @@
|
|
|
* @package Cake.Error
|
|
|
*/
|
|
|
if (!class_exists('HttpException')) {
|
|
|
- class HttpException extends RuntimeException {
|
|
|
+ class HttpException extends CakeBaseException {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -168,7 +205,7 @@ class InternalErrorException extends HttpException {
|
|
|
*
|
|
|
* @package Cake.Error
|
|
|
*/
|
|
|
-class CakeException extends RuntimeException {
|
|
|
+class CakeException extends CakeBaseException {
|
|
|
|
|
|
/**
|
|
|
* Array of attributes that are passed in from the constructor, and
|