Removing the trigger_error and view re-renders and replacing them with exceptions.

This commit is contained in:
mark_story 2010-11-04 22:36:37 -04:00
parent 76919902b9
commit 882efa883e

View file

@ -399,25 +399,22 @@ class View extends Object {
if ($layout === null) { if ($layout === null) {
$layout = $this->layout; $layout = $this->layout;
} }
if ($out === false) {
if ($out !== false) { throw new RuntimeException(sprintf(__("Error in view %s, got no content."), $viewFileName));
if ($layout && $this->autoLayout) {
$out = $this->renderLayout($out, $layout);
$isCached = (
isset($this->Helpers->Cache) ||
Configure::read('Cache.check') === true
);
if ($isCached) {
$replace = array('<cake:nocache>', '</cake:nocache>');
$out = str_replace($replace, '', $out);
}
}
$this->hasRendered = true;
} else {
$out = $this->_render($viewFileName, $this->viewVars);
trigger_error(sprintf(__("Error in view %s, got: <blockquote>%s</blockquote>"), $viewFileName, $out), E_USER_ERROR);
} }
if ($layout && $this->autoLayout) {
$out = $this->renderLayout($out, $layout);
$isCached = (
isset($this->Helpers->Cache) ||
Configure::read('Cache.check') === true
);
if ($isCached) {
$replace = array('<cake:nocache>', '</cake:nocache>');
$out = str_replace($replace, '', $out);
}
}
$this->hasRendered = true;
return $out; return $out;
} }
@ -454,9 +451,7 @@ class View extends Object {
$this->output = $this->_render($layoutFileName); $this->output = $this->_render($layoutFileName);
if ($this->output === false) { if ($this->output === false) {
$this->output = $this->_render($layoutFileName, $data_for_layout); throw new RuntimeException(sprintf(__("Error in layout %s, got no content."), $layoutFileName));
trigger_error(sprintf(__("Error in layout %s, got: <blockquote>%s</blockquote>"), $layoutFileName, $this->output), E_USER_ERROR);
return false;
} }
$this->Helpers->trigger('afterLayout', array(&$this, $layoutFileName, $this->output)); $this->Helpers->trigger('afterLayout', array(&$this, $layoutFileName, $this->output));