Grails

Can't register custom exception handlers

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.2-M3
  • 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

Activity

Hide
Graeme Rocher added a comment -

fixed thanks

Show
Graeme Rocher added a comment - fixed thanks

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: