Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: 2.3-M2
-
Component/s: None
-
Labels:None
-
Patch Submitted:Yes
Description
It's not possible to register custom exception pages for GrailsExceptionResolver since exceptions are wrapped as org.codehaus.groovy.runtime.InvokerInvocationException. But if you add this at the top of GrailsExceptionResolver.resolveException():
if (e instanceof InvokerInvocationException) { e = (Exception)getRootCause(e); }
then the exception mappings will use the real exception to lookup the page to use.
See this thread for discussion: http://www.nabble.com/Custom-exception-handling---GrailsExceptionResolver-generating--NullPointerException-td25206893.html
This is still a problem - the fix only unwraps 1 level of Grails exception wrapping. If you have a service throwing an exception you get the exception wrapped from the service, and then another wrapped exception from the Controller so to get to the actual exception that caused the problem you have to unwrap it twice.