Indicate which file was being parsed if an exception is thrown while running translation:debug
When running the translation:debug command, if a template contains invalid twig markup, an exception is thrown. This patch rethrows a new exception that includes the filename being parsed in the message to aid debuging.
This commit is contained in:
parent
9ea4296028
commit
b1bffc0516
|
@ -58,7 +58,12 @@ class TwigExtractor implements ExtractorInterface
|
|||
$finder = new Finder();
|
||||
$files = $finder->files()->name('*.twig')->in($directory);
|
||||
foreach ($files as $file) {
|
||||
$this->extractTemplate(file_get_contents($file->getPathname()), $catalogue);
|
||||
try {
|
||||
$this->extractTemplate(file_get_contents($file->getPathname()), $catalogue);
|
||||
} catch (\Twig_Error $e) {
|
||||
$e->setTemplateFile($file->getPathname());
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in New Issue