A little clarification - the order does matter, but not as much as it does in 
Java.

For the code snippets you posted, it doesn’t make any difference.  You’ve 
defined one onException block than handles multiple exceptions.  The order of 
the onException blocks themselves can effect which block is matches (in the 
case of two exceptions with the same “distance” from the caught exception).

The link souciance provided has an ok discussion of this, but Claus’s book 
(Camel In Action) has a much better discussion - an entire chapter on error 
handling.

> On Nov 4, 2016, at 3:35 AM, souciance <souciance.eqdam.ras...@gmail.com> 
> wrote:
> 
> Yeah the order does matter, take a look at
> http://camel.apache.org/exception-clause.html 
> <http://camel.apache.org/exception-clause.html> , there is section in the
> beginning that shows an example of how camel looks and matches exceptions.
> 
> On Fri, Nov 4, 2016 at 7:46 AM, Demon Hunter [via Camel] <
> ml-node+s465427n5789729...@n5.nabble.com 
> <mailto:ml-node+s465427n5789729...@n5.nabble.com>> wrote:
> 
>> there are two exception I handle in my current camel route as below
>> 
>> <onException>
>> <exception>java.lang.Exception</exception>
>> <exception>com.swift.ipla.types.InvalidSyntaxException</exception>
>> 
>> <setHeader headerName="HeaderMsg">
>>        <simple>${exception.message}</simple>
>> </setHeader>
>> <setHeader headerName="HeaderCause">
>>        <simple>${exception.cause}</simple>
>> </setHeader>
>> </onException>
>> 
>> In java, we have to catch general exception later and specific exception
>> need to catch first. If we also need to do such that in apache camel. If
>> so, my code will be like below? or it doesn't make any differences?
>> 
>> <onException>
>> <exception>com.swift.ipla.types.InvalidSyntaxException</exception>
>> <exception>java.lang.Exception</exception>
>> 
>> <setHeader headerName="HeaderMsg">
>>        <simple>${exception.message}</simple>
>> </setHeader>
>> <setHeader headerName="HeaderCause">
>>        <simple>${exception.cause}</simple>
>> </setHeader>
>> </onException>
>> 
>> 
>> ------------------------------
>> If you reply to this email, your message will be added to the discussion
>> below:
>> http://camel.465427.n5.nabble.com/exception-handling-tp5789729.html 
>> <http://camel.465427.n5.nabble.com/exception-handling-tp5789729.html>
>> To start a new topic under Camel - Users, email
>> ml-node+s465427n465428...@n5.nabble.com 
>> <mailto:ml-node+s465427n465428...@n5.nabble.com>
>> To unsubscribe from Camel - Users, click here
>> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=c291Y2lhbmNlLmVxZGFtLnJhc2h0aUBnbWFpbC5jb218NDY1NDI4fDE1MzI5MTE2NTY=
>>  
>> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=c291Y2lhbmNlLmVxZGFtLnJhc2h0aUBnbWFpbC5jb218NDY1NDI4fDE1MzI5MTE2NTY=>>
>> .
>> NAML
>> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
>>  
>> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>>
>> 
> 
> 
> 
> 
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/exception-handling-tp5789729p5789744.html 
> <http://camel.465427.n5.nabble.com/exception-handling-tp5789729p5789744.html>
> Sent from the Camel - Users mailing list archive at Nabble.com 
> <http://nabble.com/>.

Reply via email to