To customize the error page I created an error404.html.twig page to handle the page not found exception like when the user enter an invalid url for example. it works fine but I also need to display different messages according to errors in my application.
For that I use the createNotFoundException() method with a message as parameter but the message doesnt appear when the exception is thrown I always have the message in the error404.html.twig template. So how can I display the message parameter from the createNotFoundException() in my error page template? Thanks for your help