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) {
|
if (false === $file || null === $file) {
|
||||||
list($namespace, $name) = $this->parseName($logicalName);
|
try {
|
||||||
$paths = $this->getPaths($namespace);
|
list($namespace, $name) = $this->parseName($logicalName);
|
||||||
array_walk($paths, function (&$path) use ($name) { $path .= '/'.$name; });
|
$paths = sprintf(' (looked into: %s)', implode(', ', $this->getPaths($namespace)));;
|
||||||
throw new \Twig_Error_Loader(sprintf('Unable to find template "%s" (tried: %s).', $name, implode(', ', $paths)), -1, null, $previous);
|
} 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;
|
||||||
|
Reference in New Issue
Block a user