Description
Currently, the doc explains how to overwrite the error page rendered by the controller.
This is fine for apps wanting to make the error page look better by having them consistent with their styles.
However, the exception handling system of Symfony is much more flexible than that. This can be particularly useful if you throw domain-related exceptions in your codebase which should be rendered as client errors rather than a 500 page for instance.
The usage of listeners on the kernel.exception
event allows to handle this case very easily, and without requiring to use subrequests and a controller. See symfony/symfony#11752 (comment) for the original discussion.
As a side note, this is exactly what the Security component does in core for the Symfony\Component\Security\Core\Exception\AccessDeniedException
.
I don't know a public project using this approach (but I'm very far from knowing the codebase all open-source projects based on Symfony). However @weaverryan, I know that KnpLabs used this approach already in one of its project for which I saw the codebase when I was working there. So some of your colleagues should be able to show you this approach at least.