Browse files

[TwigBundle] made error message more explicit

  • Loading branch information...
1 parent e2ea634 commit 2ae542748a8065aba925b44b99755010dbf12ac9 @fabpot fabpot committed Feb 5, 2011
Showing with 4 additions and 6 deletions.
  1. +4 −6 src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php
View
10 src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php
@@ -75,25 +75,23 @@ public function isFresh($name, $time)
protected function findTemplate($name)
{
- if (!is_array($name)) {
- $name = $this->parser->parse($name);
- }
+ $tpl = is_array($name) ? $name : $this->parser->parse($name);
- $key = md5(serialize($name));
+ $key = md5(serialize($tpl));
if (isset($this->cache[$key])) {
return $this->cache[$key];
}
$file = null;
$previous = null;
try {
- $file = $this->locator->locate($name);
+ $file = $this->locator->locate($tpl);
} catch (\InvalidArgumentException $e) {
$previous = $e;
}
if (false === $file || null === $file) {
- throw new \Twig_Error_Loader(sprintf('Unable to find template "%s".', $name), 0, null, $previous);
+ throw new \Twig_Error_Loader(sprintf('Unable to find template "%s".', json_encode($name)), 0, null, $previous);
}
return $this->cache[$key] = $file;

0 comments on commit 2ae5427

Please sign in to comment.