[ https://issues.apache.org/jira/browse/CAMEL-4022?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13040246#comment-13040246 ]
Hadrian Zbarcea commented on CAMEL-4022: ---------------------------------------- @Claus, thanks for the input. That's the issue, what if I don't want handled(true) and to("direct:someRoute") fails? For the situation you mention where there is an onException handling the exception thrown while handling, that should *not* trigger. That is only meant for exceptions thrown on the route, not while handling. I believe exception thrown while handling have a special status and should be handled differently, in a simple, predictable way, not by the ErrorHandler configured for the route. We need to come up with a good convention. > Issue using errorBuilderRef with the xml dsl > -------------------------------------------- > > Key: CAMEL-4022 > URL: https://issues.apache.org/jira/browse/CAMEL-4022 > Project: Camel > Issue Type: Bug > Affects Versions: 2.7.1 > Reporter: Hadrian Zbarcea > Assignee: Hadrian Zbarcea > > While fixing issues around the errorHandler I noticed that <onException> > definitions defined in the camel context are ignored if a route specifies its > own errorHandlerRef. The reason is that we set the onException definition on > the default error handler. I have a fix for that, but I discovered a > different issue (I think) for which I would like to discuss the solution. > When we have an onException definition that looks kinda like this: > {code} > <onException> > <exception> java.lang.IllegalArgumentException</exception> > <to uri="mock:illegalArgumentException"/> > </onException> > {code} > ... something happens, the IAE exception is caught, we do something, but in > that process another exception is thrown. Currently, that would be caught by > the default error handler, which may not be what we want. > What error handler (if any) should handle exceptions thrown while in > onException? > The onException mechanism is somewhat similar to a try/catch. I don't think > the exceptions thrown while handling onException should be handled by the > same error handler configured for the route, or even the context scoped one. > The processing should be very simple, predictable and immutable. Since the > default "CamelDefaultErrorHandlerBuilder" can be replaced, it is not imho a > solution and we need one global one that does as little as possible (the > problem would be agreeing what that is: no redeliveries, logging or not, etc). > Thoughts? -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira