[
https://issues.apache.org/jira/browse/CAMEL-6928?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13818412#comment-13818412
]
Claus Ibsen commented on CAMEL-6928:
------------------------------------
And btw you are doing this a bit wrong if you want exceptions from the 2nd
route to be reacted by the onException in the 1st route.
If so you need to set the 2nd route to not use any error handler, by setting
the errorHandlerRef attribute
{code:xml}
<route errorHandlerRef="noError">
<from uri="seda:decoupledEndpoint"/>
<throwException ref="ex"/>
</route>
{code}
And then define that no error handler in the camel context
{code:xml}
<camel:camelContext xmlns="http://camel.apache.org/schema/spring">
<camel:errorHandler id="noError" type="NoErrorHandler"/>
</camel:camelContext>
{code}
This is the same also if you are not using the <routes>, but just had the
routes directly inside the <camelContext>
> onException is not considered for programatically added routes
> ---------------------------------------------------------------
>
> Key: CAMEL-6928
> URL: https://issues.apache.org/jira/browse/CAMEL-6928
> Project: Camel
> Issue Type: Improvement
> Components: camel-core
> Affects Versions: 2.10.0, 2.12.1
> Reporter: Veniamin Goldin
> Fix For: 2.13.0
>
> Attachments: test-exception-handling.zip
>
>
> The onException is not working for the route added to the CamelContext as
> RouteDefinition, programatically as described in
> http://camel.apache.org/loading-routes-from-xml-files.html
> The exception is being propagated to the error handler. The same applies for
> doTry on the route level and onException on the CamelContext level.
> *Update:* doTry does not work if there is an "onException" defined in the
> route.
> See test project attached.
--
This message was sent by Atlassian JIRA
(v6.1#6144)