I’m using Grails with the routing plugin to define routes using the RouteBuilder DSL.
If I have a scenario like the following:
...
//configure method for route builder A
def configure {
onException(CustomException).process(exceptionProcessor)
from(<route A.1>)...
from(<route A.2>)...
}
...
...
//configure method for route builder B
def configure {
onException(CustomException).process(exceptionProcessor)
from(<route B.1>)...
}
...
In this scenario, does onException(CustomException).process(exceptionProcessor) define a global exception handler which covers routes A.1, A.2, and B.1, or does it define route specific exception handlers which only encompass the routes configured within the same RouteBuilder (i.e. A.1 and A.2)?
It will create an exception handler local to the Specific route builder in which it is defined. But it will span over all routes in that particular route builder. That is, in Java. However, I think there is no difference since your groovy code compiles to java pretty much the same way.