Throw proper exceptions if a variable in a template cannot be found.

develop
Sven Slootweg 12 years ago
parent 890296f25e
commit 7034837966

@ -575,7 +575,14 @@ class TemplateSyntaxElement
{
if(strpos($name, "[") === false)
{
return $data[$name];
if(isset($data[$name]))
{
return $data[$name];
}
else
{
throw new TemplateEvaluationException("Could not find the variable {$name} in the dataset.");
}
}
else
{
@ -602,11 +609,13 @@ class TemplateSyntaxElement
}
else
{
return false;
throw new TemplateEvaluationException("Error while fetching {$name}; the {$item} variable does not exist in the specified object.");
}
}
}
}
throw new TemplateEvaluationException("Could not find the variable {$name} anywhere in the tree.");
}
}
}

@ -50,3 +50,4 @@ class NotFoundException extends Exception
class TemplateSyntaxException extends TemplateException {}
class TemplateParsingException extends TemplateException {}
class TemplateEvaluationException extends Exception {}

Loading…
Cancel
Save