I'm trying to create a custom exception controller in php Symfony 4. Essentially what I want to do is to have a default route that gets called when no other routes match.
I'm trying to follow the suggestions here: https://symfony.com/doc/current/controller/error_pages.html#custom-exception-controller
I've created the twig.yaml file inside configs>>pacakges:
twig:
exception_controller: App\Controller\ExceptionController::showException
I've also created the ExceptionController class:
<?php
namespace App\Controller;
use Symfony\Component\HttpFoundation\Response;
class ExceptionController
{
public function showException()
{
$response = new Response();
$response->setContent("Some random text");
$response->headers->set('Content-Type', 'text/plain');
$response->headers->set('Access-Control-Allow-Origin', '*');
$response->setStatusCode(200);
return $response;
}
}
When I visit a url that does not exist I'm expecting to see the text "Some random text" but instead I get the default symfony not found page:
Any ideas what I might be doing wrong?

configs- this should beconfig. Can you clarify the path of your twig.yaml?