user2019515
user2019515

Reputation: 4503

Symfony2 use NotFoundException message

In Symfony 2 you can do the following to return a 404 page

throw $this->createNotFoundException('message');

I was assuming that status_text in the error template would display the custom message, but that does not seem to be the case. How can you display the custom message?

Short question, but I dont think this needs more information? Feel free to ask!

Upvotes: 3

Views: 497

Answers (1)

gremo
gremo

Reputation: 48487

Looking at the show action of ExceptionController you can access the exception inside twig:

{{ exception.message }}

status_text and status_code are related to the HTTP protocol. To customize the error page look at the official documentation.

Upvotes: 2

Related Questions