Exception controller sync with TwigBundle

I noticed that the exception controller code has some copy/paste of code from TwigBundle. This PR just syncs the code between the two bundles.