unify exception and error handling.

This commit is contained in:
euromark 2014-01-03 12:42:52 +01:00
parent 3cee3b0e99
commit a02ab67521
4 changed files with 12 additions and 12 deletions

View file

@ -189,9 +189,9 @@ class ExceptionRenderer {
$this->controller->set(array( $this->controller->set(array(
'code' => $code, 'code' => $code,
'url' => h($url), 'url' => h($url),
'name' => h($error->getMessage()), 'message' => h($error->getMessage()),
'error' => $error, 'error' => $error,
'_serialize' => array('code', 'url', 'name') '_serialize' => array('code', 'url', 'message')
)); ));
$this->controller->set($error->getAttributes()); $this->controller->set($error->getAttributes());
$this->_outputMessage($this->template); $this->_outputMessage($this->template);
@ -211,10 +211,10 @@ class ExceptionRenderer {
$url = $this->controller->request->here(); $url = $this->controller->request->here();
$this->controller->response->statusCode($error->getCode()); $this->controller->response->statusCode($error->getCode());
$this->controller->set(array( $this->controller->set(array(
'name' => h($message),
'url' => h($url), 'url' => h($url),
'message' => h($message),
'error' => $error, 'error' => $error,
'_serialize' => array('name', 'url') '_serialize' => array('url', 'message')
)); ));
$this->_outputMessage('error400'); $this->_outputMessage('error400');
} }
@ -234,10 +234,10 @@ class ExceptionRenderer {
$code = ($error->getCode() > 500 && $error->getCode() < 506) ? $error->getCode() : 500; $code = ($error->getCode() > 500 && $error->getCode() < 506) ? $error->getCode() : 500;
$this->controller->response->statusCode($code); $this->controller->response->statusCode($code);
$this->controller->set(array( $this->controller->set(array(
'name' => h($message), 'url' => h($url),
'message' => h($url), 'message' => h($message),
'error' => $error, 'error' => $error,
'_serialize' => array('name', 'message') '_serialize' => array('url', 'message')
)); ));
$this->_outputMessage('error500'); $this->_outputMessage('error500');
} }
@ -255,9 +255,9 @@ class ExceptionRenderer {
$this->controller->set(array( $this->controller->set(array(
'code' => $code, 'code' => $code,
'url' => h($url), 'url' => h($url),
'name' => h($error->getMessage()), 'message' => h($error->getMessage()),
'error' => $error, 'error' => $error,
'_serialize' => array('code', 'url', 'name', 'error') '_serialize' => array('code', 'url', 'message', 'error')
)); ));
$this->_outputMessage($this->template); $this->_outputMessage($this->template);
} }

View file

@ -1,4 +1,4 @@
<h2><?php echo $name; ?></h2> <h2><?php echo $message; ?></h2>
<p class="error"> <p class="error">
<strong><?php echo __d('cake', 'Error'); ?>: </strong> <strong><?php echo __d('cake', 'Error'); ?>: </strong>
<?php printf( <?php printf(

View file

@ -1,4 +1,4 @@
<h2><?php echo $name; ?></h2> <h2><?php echo $message; ?></h2>
<p class="error"> <p class="error">
<strong><?php echo __d('cake', 'Error'); ?>: </strong> <strong><?php echo __d('cake', 'Error'); ?>: </strong>
<?php echo __d('cake', 'An Internal Error Has Occurred.'); ?> <?php echo __d('cake', 'An Internal Error Has Occurred.'); ?>

View file

@ -19,7 +19,7 @@
<h2><?php echo __d('cake_dev', 'Database Error'); ?></h2> <h2><?php echo __d('cake_dev', 'Database Error'); ?></h2>
<p class="error"> <p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong> <strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo $name; ?> <?php echo $message; ?>
</p> </p>
<?php if (!empty($error->queryString)) : ?> <?php if (!empty($error->queryString)) : ?>
<p class="notice"> <p class="notice">