Skip to content

Commit

Permalink
unify exception and error handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
euromark committed Jan 3, 2014
1 parent 3cee3b0 commit a02ab67
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions lib/Cake/Error/ExceptionRenderer.php
Expand Up @@ -189,9 +189,9 @@ protected function _cakeError(CakeException $error) {
$this->controller->set(array(
'code' => $code,
'url' => h($url),
'name' => h($error->getMessage()),
'message' => h($error->getMessage()),
'error' => $error,
'_serialize' => array('code', 'url', 'name')
'_serialize' => array('code', 'url', 'message')
));
$this->controller->set($error->getAttributes());
$this->_outputMessage($this->template);
Expand All @@ -211,10 +211,10 @@ public function error400($error) {
$url = $this->controller->request->here();
$this->controller->response->statusCode($error->getCode());
$this->controller->set(array(
'name' => h($message),
'url' => h($url),
'message' => h($message),
'error' => $error,
'_serialize' => array('name', 'url')
'_serialize' => array('url', 'message')
));
$this->_outputMessage('error400');
}
Expand All @@ -234,10 +234,10 @@ public function error500($error) {
$code = ($error->getCode() > 500 && $error->getCode() < 506) ? $error->getCode() : 500;
$this->controller->response->statusCode($code);
$this->controller->set(array(
'name' => h($message),
'message' => h($url),
'url' => h($url),
'message' => h($message),
'error' => $error,
'_serialize' => array('name', 'message')
'_serialize' => array('url', 'message')
));
$this->_outputMessage('error500');
}
Expand All @@ -255,9 +255,9 @@ public function pdoError(PDOException $error) {
$this->controller->set(array(
'code' => $code,
'url' => h($url),
'name' => h($error->getMessage()),
'message' => h($error->getMessage()),
'error' => $error,
'_serialize' => array('code', 'url', 'name', 'error')
'_serialize' => array('code', 'url', 'message', 'error')
));
$this->_outputMessage($this->template);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/test_app/View/Errors/error400.ctp
@@ -1,4 +1,4 @@
<h2><?php echo $name; ?></h2>
<h2><?php echo $message; ?></h2>
<p class="error">
<strong><?php echo __d('cake', 'Error'); ?>: </strong>
<?php printf(
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/test_app/View/Errors/error500.ctp
@@ -1,4 +1,4 @@
<h2><?php echo $name; ?></h2>
<h2><?php echo $message; ?></h2>
<p class="error">
<strong><?php echo __d('cake', 'Error'); ?>: </strong>
<?php echo __d('cake', 'An Internal Error Has Occurred.'); ?>
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/View/Errors/pdo_error.ctp
Expand Up @@ -19,7 +19,7 @@
<h2><?php echo __d('cake_dev', 'Database Error'); ?></h2>
<p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo $name; ?>
<?php echo $message; ?>
</p>
<?php if (!empty($error->queryString)) : ?>
<p class="notice">
Expand Down

0 comments on commit a02ab67

Please sign in to comment.