Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache Camel: exchange.getException() vs CamelExceptionCaught property

Tags:

apache-camel

Sometimes when I debug route I see exception in exchange, other times exception goes to CamelExceptionCaught property. What's the difference between them?

like image 961
divideByZero Avatar asked Jan 07 '23 00:01

divideByZero


1 Answers

When the error handler handles the exception it moves the exception from exchange.getException to the exchange property. This is done so the error handler and Camel knows it has been handled. If the exchange is then continued routed and a new exception is thrown/set on the exchange, then the error handler is able to react again.

See this FAQ: http://camel.apache.org/why-is-the-exception-null-when-i-use-onexception.html

like image 110
Claus Ibsen Avatar answered May 11 '23 01:05

Claus Ibsen