If we don't have this method called, then the controller returns an object. From then on, [Symfony converts this object in to a string](https://github.com/symfony/HttpFoundation/blob/master/Response.php#L406). This string is **not just the content of the view**, but the headers as well.
After attaching this method, `handleCustomError()` returns a string and everything works as expected.
Previously Twig syntax errors inside a component partial would show the incorrect file and line number. This is fixed.
Also simplified the approach so the stack trace is not hidden inside a closure.