Following the docs http://symfony.com/doc/current/cookbook/controller/error_pages.html I have been able to add my own template for errors;
app
|- Resources
| | - TwigBundle
| | |- view
| | | |- Exception
| | | | |- exception.html.twig
| | | | |- error.html.twig
| | | | |- error400.html.twig
| | | | |- error404.html.twig
| | | | |- error500.html.twig
| | | |- layout.html.twig
|- config
This works perfectly, but how do I keep the stack traces and the detailed errors for my dev environment?
In production I wish to use my own templates, in the dev environment I wish to use Symfony2's own templates.
Symfony2
(v2.5
) still threw "green" alien page with complete stacktrace, while I was indev
mode. However, if I move toprod
, my custom error page is shown instead. – Jovan Perovicapp
? – Jake Nerror403.html.twig
. Do you useSymfony 2.6
on something else? They have made some things easier with previewing error pages as of2.6
. – Jovan Perovic2.5
, I have error and exception. Does 403 get overridden in dev mode for you? – Jake Ndev
no, but inprod
yes. At one point I wished that was the case as it really slowed down the testing oferror403.html.twig
layout (had tocache:clear
after each change...) – Jovan Perovic