Commit d379120e authored by Taddeus Kroes's avatar Taddeus Kroes

Template class now uses FormattedException instead of RuntimeException

parent b646dfc0
...@@ -158,9 +158,9 @@ class Template extends Node { ...@@ -158,9 +158,9 @@ class Template extends Node {
} }
if (!$found) { if (!$found) {
throw new \RuntimeException( throw new FormattedException(
sprintf("Could not find template file \"%s\", looked in folders:\n%s", "Could not find template file \"%s\", looked in folders:\n%s",
$filename, implode("\n", $look_in)) $filename, implode("\n", $look_in)
); );
} }
...@@ -455,7 +455,7 @@ class Template extends Node { ...@@ -455,7 +455,7 @@ class Template extends Node {
// <nested_exp>||<nested_exp> // <nested_exp>||<nested_exp>
try { try {
return self::evaluateExpression(substr($expression, 0, $split_at), $data, false); return self::evaluateExpression(substr($expression, 0, $split_at), $data, false);
} catch(\RuntimeException $e) { } catch(\Exception $e) {
return self::evaluateExpression(substr($expression, $split_at + 2), $data, false); return self::evaluateExpression(substr($expression, $split_at + 2), $data, false);
} }
} }
...@@ -505,7 +505,7 @@ class Template extends Node { ...@@ -505,7 +505,7 @@ class Template extends Node {
* *
* @package WebBasics * @package WebBasics
*/ */
class ParseError extends \RuntimeException { class ParseError extends \Exception {
/** /**
* Constructor. * Constructor.
* *
......
...@@ -92,7 +92,7 @@ class TemplateTest extends PHPUnit_Framework_TestCase { ...@@ -92,7 +92,7 @@ class TemplateTest extends PHPUnit_Framework_TestCase {
} }
/** /**
* @expectedException RuntimeException * @expectedException webbasics\FormattedException
*/ */
function testNonExistingTemplate() { function testNonExistingTemplate() {
$bar = new Template('bar'); $bar = new Template('bar');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment