What i have done:
I have created this custom controller cause I want to pass to the error pages some extra variables.
#Controller/CustomErrorControler.phpnamespace App\Controller;use App\Controller\Base\BaseController;use Symfony\Component\ErrorHandler\Exception\FlattenException;use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;class CustomErrorController extends BaseController{ public function show(FlattenException $exception, DebugLoggerInterface $logger = null) { return $this->getView('bundles/TwigBundle/Exception/error.html.twig', ["code" => $exception->getStatusCode(),"message" =>$exception->getStatusText() ]); }}
and the enabled
#config/packages/framework.yamlerror_controller: App\Controller\CustomErrorController::show
I have followed the documentation directly. My problem is that I need, for non-production stages to get the default exception templates provided by the framework.
I have tried to extend Symfony\Component\HttpKernel\Controller\ErrorController
but I'm getting errors for autowiring.
Maybe I should use Symfony\Component\ErrorHandler\ErrorRenderer\ErrorRendererInterface
Any ideas how to implement this?