You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2011/05/27 15:57:47 UTC

[jira] [Commented] (CAMEL-4022) Issue using errorBuilderRef with the xml dsl

    [ https://issues.apache.org/jira/browse/CAMEL-4022?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13040237#comment-13040237 ] 

Claus Ibsen commented on CAMEL-4022:
------------------------------------

The behavior should be that no error handler should be used, when routing inside the <onException>.

For example as you say if another exception, or the same type of exception occurs, then the complexity gets hard. What if there is another onException that handles that exception, and then another exception is thrown and you go back to the first onException. And so on. Eg you have to be careful to not go in circles.

The onException is to allow end users to handle that exception in any custom way. For example to prepare some custom reply message (instead of the exception).

If you want to continue routing and have error handling, then send the message to a route:
onException(x).handled(true).to("direct:someRoute");


> 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?
> [I will get back later today with the options I see, but comments are appreciated in the meantime]

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira