class MyController {
def myAction = {
throw new MyException("Test")
}
}
Is it possible to catch / handle the exception caused by the code above? The following url-mapping kinda works, but it causes the exception to be logged, which is annoying because in my case I can handle it.
"500"(controller: "error", action: 'myExceptionHandler', exception: MyException)
Why don't I wrap code that might throw an exception in try / catch? Well, I have several actions that can throw the same exception. Wrapping each of them in try / catch violates the DRY principle.
source
share