diff --git a/src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php b/src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php index 69eb54858a..3143b94b79 100644 --- a/src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php +++ b/src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php @@ -85,14 +85,15 @@ class FilesystemLoader implements \Twig_LoaderInterface } $file = null; + $previous = null; try { $file = $this->locator->locate($name); } catch (\InvalidArgumentException $e) { - // File wasn't found, will throw twig load error + $previous = $e; } - if ($file === false || $file === null) { - throw new \Twig_Error_Loader(sprintf('Unable to find template "%s".', $name)); + if (false === $file || null === $file) { + throw new \Twig_Error_Loader(sprintf('Unable to find template "%s".', $name), 0, $previous); } return $this->cache[$key] = $file;