[TwigBundle] added previous exception when possible
This commit is contained in:
parent
f217022ad5
commit
a204e0df7f
@ -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;
|
||||
|
Reference in New Issue
Block a user