Hi,
Unless you are looking to catch a specific exception, you could catch an
exception of type java.lang.Exception and then in the processor
"doSomething" you could check the exception and perform an action.
Thrown exceptions are stored in the Message Exchange and you can get the
exchange in your processor as follows
public void process(Exchange exchange) throws Exception {
// the caused by exception is stored in a property on the
exchange
Throwable caused =
exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Throwable.class);
...
}
Please find an attached example below
https://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionProcessorInspectCausedExceptionTest.java?view=co
https://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionProcessorInspectCausedExceptionTest.java?view=co
Cheers,
Ashwin...
-----
---------------------------------------------------------
Ashwin Karpe
Apache Camel Committer & Sr Principal Consultant
FUSESource (a Progress Software Corporation subsidiary)
http://fusesource.com
Blog: http://opensourceknowledge.blogspot.com
---------------------------------------------------------
--
View this message in context:
http://camel.465427.n5.nabble.com/Fetch-Custom-Exception-from-the-exchange-tp4615183p4615912.html
Sent from the Camel - Users mailing list archive at Nabble.com.