Skip to content
Permalink
Browse files

Removing the trigger_error and view re-renders and replacing them wit…

…h exceptions.
  • Loading branch information...
markstory committed Nov 5, 2010
1 parent 7691990 commit 882efa883e1c3b0cfb3530d2f40cade1f380b76c
Showing with 15 additions and 20 deletions.
  1. +15 −20 cake/libs/view/view.php
@@ -399,25 +399,22 @@ public function render($action = null, $layout = null, $file = null) {
if ($layout === null) {
$layout = $this->layout;
}
if ($out !== false) {
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);
}
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);
}
$this->hasRendered = true;
return $out;
}
@@ -454,9 +451,7 @@ public function renderLayout($content_for_layout, $layout = null) {
$this->output = $this->_render($layoutFileName);
if ($this->output === false) {
$this->output = $this->_render($layoutFileName, $data_for_layout);
trigger_error(sprintf(__("Error in layout %s, got: <blockquote>%s</blockquote>"), $layoutFileName, $this->output), E_USER_ERROR);
return false;
throw new RuntimeException(sprintf(__("Error in layout %s, got no content."), $layoutFileName));
}
$this->Helpers->trigger('afterLayout', array(&$this, $layoutFileName, $this->output));

0 comments on commit 882efa8

Please sign in to comment.
You can’t perform that action at this time.