Fixed the problem in an easier way

This commit is contained in:
Javier Eguiluz 2016-01-27 17:49:58 +01:00
parent 35f082f6ef
commit 88b913b0c4

View File

@ -78,6 +78,7 @@ class FilesystemLoader extends \Twig_Loader_Filesystem
$file = parent::findTemplate($logicalName); $file = parent::findTemplate($logicalName);
} catch (\Twig_Error_Loader $e) { } catch (\Twig_Error_Loader $e) {
$previous = $e; $previous = $e;
$errorMessage = $e->getMessage();
// for BC // for BC
try { try {
@ -89,14 +90,7 @@ class FilesystemLoader extends \Twig_Loader_Filesystem
} }
if (false === $file || null === $file) { if (false === $file || null === $file) {
try { throw new \Twig_Error_Loader($errorMessage, -1, null, $previous);
list($namespace, $name) = $this->parseName($logicalName);
$paths = sprintf(' (looked into: %s)', implode(', ', $this->getPaths($namespace)));
} catch (\Twig_Error_Loader $e) {
$paths = '';
}
throw new \Twig_Error_Loader(sprintf('Unable to find template "%s"%s.', $name, $paths, -1, null, $previous));
} }
return $this->cache[$logicalName] = $file; return $this->cache[$logicalName] = $file;