Improved the error message when a template is not found
This commit is contained in:
parent
e9d951a882
commit
968476b707
@ -89,10 +89,14 @@ class FilesystemLoader extends \Twig_Loader_Filesystem
|
||||
}
|
||||
|
||||
if (false === $file || null === $file) {
|
||||
list($namespace, $name) = $this->parseName($logicalName);
|
||||
$paths = $this->getPaths($namespace);
|
||||
array_walk($paths, function (&$path) use ($name) { $path .= '/'.$name; });
|
||||
throw new \Twig_Error_Loader(sprintf('Unable to find template "%s" (tried: %s).', $name, implode(', ', $paths)), -1, null, $previous);
|
||||
try {
|
||||
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;
|
||||
|
Reference in New Issue
Block a user