General Grails exception handling in grails 1.1

Someone tell me how to handle RunTimeExceptions in grails version 1.1. I completed the following tutorial. I could not get it to work.

http://blog.bruary.net/2008/03/grails-custom-exception-handling.html

I have a MyException that extends RunTimeException. If this particular exception comes up, I want to show the page with different errors. Can grails version 1.1 be reached?

0
source share
1 answer

Can you provide some sample code in which some RuntimeException is thrown? It is difficult to answer your question correctly unless you tell us what your exact problem is.

As far as I can tell you, your BootStrap.groovy should look something like this:

class BootStrap {
 def exceptionHandler

 def init = { servletContext ->

   exceptionHandler.exceptionMappings =
       [ 'NoSuchFlowExecutionException' :'/my/doIt',
         'java.lang.Exception' : '/error',
         'org.you.YourCustomException' : '/yourErrorController/yourErrorAction' ]
}

def destroy = { }

, RuntimeExceptions .

: ? , RuntimeExceptions ?

0

Source: https://habr.com/ru/post/1788219/


All Articles