From 40e219622a2c416ab36cb39b26a5e1354e4438cc Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 1 Oct 2016 14:51:54 +0200 Subject: Customize errors templates All error goes to the same template which only display the error message and the status code. --- .../CoreBundle/Controller/ExceptionController.php | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/Wallabag/CoreBundle/Controller/ExceptionController.php (limited to 'src/Wallabag/CoreBundle/Controller/ExceptionController.php') diff --git a/src/Wallabag/CoreBundle/Controller/ExceptionController.php b/src/Wallabag/CoreBundle/Controller/ExceptionController.php new file mode 100644 index 00000000..abfa9c2f --- /dev/null +++ b/src/Wallabag/CoreBundle/Controller/ExceptionController.php @@ -0,0 +1,40 @@ +templateExists($template)) { + return $template; + } + } + + // try to find a template for the given format + $template = sprintf('@Twig/Exception/%s.%s.twig', $name, $format); + if ($this->templateExists($template)) { + return $template; + } + + // default to a generic HTML exception + $request->setRequestFormat('html'); + + return sprintf('@Twig/Exception/%s.html.twig', $showException ? 'exception_full' : $name); + } +} -- cgit v1.2.3