Skip to content

Commit

Permalink
fixed output when an error occurs in a template and render() is used (c…
Browse files Browse the repository at this point in the history
…loses twigphp#23)

git-svn-id: http://svn.twig-project.org/trunk@126 93ef8e89-cb99-4229-a87c-7fa0fa45744b
  • Loading branch information
fabien committed Nov 10, 2009
1 parent 5d28604 commit 74dbd38
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/Twig/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,16 @@ abstract class Twig_Template extends Twig_Resource implements Twig_TemplateInter
public function render(array $context)
{
ob_start();
$this->display($context);
try
{
$this->display($context);
}
catch (Exception $e)
{
ob_end_clean();

throw $e;
}

return ob_get_clean();
}
Expand Down

0 comments on commit 74dbd38

Please sign in to comment.