fixed output when an error occurs in a template and render() is used (closes #23)
authorfabien <fabien@93ef8e89-cb99-4229-a87c-7fa0fa45744b>
Tue, 10 Nov 2009 21:39:18 +0000 (21:39 +0000)
committerfabien <fabien@93ef8e89-cb99-4229-a87c-7fa0fa45744b>
Tue, 10 Nov 2009 21:39:18 +0000 (21:39 +0000)
git-svn-id: http://svn.twig-project.org/trunk@126 93ef8e89-cb99-4229-a87c-7fa0fa45744b

lib/Twig/Template.php

index c7fd399..d37e7be 100644 (file)
@@ -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();
   }