If you have a copy of Camel in action book, read chapter 5, section 5.5

Use onException(Exception.class).onWhen and implement your own logic.


On Fri, Feb 20, 2015 at 7:19 PM, toomanyedwards
<toomanyedwa...@gmail.com> wrote:
> Hi all,
>   I have situation like this.  My route can throw the following exceptions:
>
>   ApplicationExceptionFoo->caused by IOException
>   ApplicationExceptionBar->caused by IOException
>   Generic IOException
>
> I want to be able to specifically trap ApplicationExceptionFoo,
> ApplicationExceptionBar and generic IOExceptions (that were not the cause
> ApplicationExceptionFoo or ApplicationExceptionBar exceptions).  No matter
> what order I define my onException handlers in Camel will always use the
> IOException handler since Camel starts its exception matching at the bottom
> of the exception cause chain rather the top.
>
> onException(ApplicationExceptionFoo.class)...
> onException(ApplicationExceptionBar.class)...
> onException(IOException.class)...
>
> What's the camel best practice here to catch most specific exceptions first
> rather than their more generic cause?  Thanks!
>
>
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/How-to-trap-most-specific-exceptions-tp5762994.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Reply via email to