I have a mapping for “500” errors in my UrlMapings which renders a custom error page and it works fine, except for when the exception happens in the custom taglib implementation or in part included through g:include.
If that happens the error page gets rendered as a part of the surround layout in a place where the problematic tag or g:include was.
I understand that this is an expected behavior but is there a way to force such an error to result in redirect or rendering the error page outside of the parent layout instead of ending with a page containing partially rendered content and several error page parts in it?
I usually resolve this issue outside of the application: In production I usually have an nginx in front of my tomcat. This will intercept all pages, which have an 500 http code in the header and show up a static error page:
This way, it doesn’t matter whether a sub view is broken or the action code itself.