Simplified everything

This commit is contained in:
Javier Eguiluz 2016-03-01 15:47:09 +01:00
parent 19bfa2ed8c
commit 0134d76785

View File

@ -77,20 +77,18 @@ class FilesystemLoader extends \Twig_Loader_Filesystem
try { try {
$file = parent::findTemplate($logicalName); $file = parent::findTemplate($logicalName);
} catch (\Twig_Error_Loader $e) { } catch (\Twig_Error_Loader $e) {
$previous = $e; $twigLoaderException = $e;
$errorMessage = $e->getMessage();
// for BC // for BC
try { try {
$template = $this->parser->parse($template); $template = $this->parser->parse($template);
$file = $this->locator->locate($template); $file = $this->locator->locate($template);
} catch (\Exception $e) { } catch (\Exception $e) {
$previous = $e;
} }
} }
if (false === $file || null === $file) { if (false === $file || null === $file) {
throw new \Twig_Error_Loader($errorMessage, -1, null, $previous); throw $twigLoaderException;
} }
return $this->cache[$logicalName] = $file; return $this->cache[$logicalName] = $file;