[WebProfilerBundle] Throw exception if a collector template isn't found

This commit is contained in:
Jordi Boggiano 2011-08-24 10:38:03 +02:00
parent 6ca72cf9ac
commit 89f477eb0a

View File

@ -265,11 +265,18 @@ class ProfilerController extends ContainerAware
}
list($name, $template) = $arguments;
if (!$profiler->has($name)) {
continue;
}
if ('.html.twig' === substr($template, -10)) {
$template = substr($template, 0, -10);
}
if (!$profiler->has($name) || !$this->container->get('templating')->exists($template.'.html.twig')) {
continue;
if (!$this->container->get('templating')->exists($template.'.html.twig')) {
throw new \UnexpectedValueException(sprintf(
'The profiler template "%s.html.twig" for data collector "%s" does not exist.',
$template,
$name
));
}
$templates[$name] = $template.'.html.twig';