camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toomanyedwards <toomanyedwa...@gmail.com>
Subject How to trap most specific exceptions?
Date Fri, 20 Feb 2015 18:19:40 GMT
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.

Mime
View raw message