3 namespace Wallabag\CoreBundle\Controller
;
5 use Symfony\Bundle\TwigBundle\Controller\ExceptionController
as BaseExceptionController
;
6 use Symfony\Component\HttpFoundation\Request
;
9 * This controller allow us to customize the error template.
10 * The only modified line from the parent template is for "WallabagCoreBundle".
12 class ExceptionController
extends BaseExceptionController
14 protected function findTemplate(Request
$request, $format, $code, $showException)
16 $name = $showException ? 'exception' : 'error';
17 if ($showException && 'html' === $format) {
18 $name = 'exception_full';
21 // For error pages, try to find a template for the specific HTTP status code and format
22 if (!$showException) {
23 $template = sprintf('WallabagCoreBundle:Exception:%s.%s.twig', $name, $format);
24 if ($this->templateExists($template)) {
29 // try to find a template for the given format
30 $template = sprintf('@Twig/Exception/%s.%s.twig', $name, $format);
31 if ($this->templateExists($template)) {
35 // default to a generic HTML exception
36 $request->setRequestFormat('html');
38 return sprintf('@Twig/Exception/%s.html.twig', $showException ? 'exception_full' : $name);