Skip to content

Commit

Permalink
Removing the trigger_error and view re-renders and replacing them wit…
Browse files Browse the repository at this point in the history
…h exceptions.
  • Loading branch information
markstory committed Nov 7, 2010
1 parent 7691990 commit 882efa8
Showing 1 changed file with 15 additions and 20 deletions.
35 changes: 15 additions & 20 deletions cake/libs/view/view.php
Expand Up @@ -399,25 +399,22 @@ public function render($action = null, $layout = null, $file = null) {
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); if ($layout && $this->autoLayout) {
$isCached = ( $out = $this->renderLayout($out, $layout);
isset($this->Helpers->Cache) || $isCached = (
Configure::read('Cache.check') === true isset($this->Helpers->Cache) ||
); Configure::read('Cache.check') === true

);
if ($isCached) {
$replace = array('<cake:nocache>', '</cake:nocache>'); if ($isCached) {
$out = str_replace($replace, '', $out); $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; return $out;
} }


Expand Down Expand Up @@ -454,9 +451,7 @@ public function renderLayout($content_for_layout, $layout = null) {
$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));
Expand Down

0 comments on commit 882efa8

Please sign in to comment.