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 {
}
if (!$found) {
throw new \RuntimeException(
sprintf("Could not find template file \"%s\", looked in folders:\n%s",
$filename, implode("\n", $look_in))
throw new FormattedException(
"Could not find template file \"%s\", looked in folders:\n%s",
$filename, implode("\n", $look_in)
);
}
......@@ -455,7 +455,7 @@ class Template extends Node {
// <nested_exp>||<nested_exp>
try {
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);
}
}
......@@ -505,7 +505,7 @@ class Template extends Node {
*
* @package WebBasics
*/
class ParseError extends \RuntimeException {
class ParseError extends \Exception {
/**
* Constructor.
*
......
......@@ -92,7 +92,7 @@ class TemplateTest extends PHPUnit_Framework_TestCase {
}
/**
* @expectedException RuntimeException
* @expectedException webbasics\FormattedException
*/
function testNonExistingTemplate() {
$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