Thomas Küstermann created CAMEL-15020:
-----------------------------------------
Summary: Improve FAQ: Why is the exception null when I use
onException?
Key: CAMEL-15020
URL: https://issues.apache.org/jira/browse/CAMEL-15020
Project: Camel
Issue Type: Improvement
Components: documentation
Reporter: Thomas Küstermann
The FAQ article [Why is the exception null when I use
onException?|https://camel.apache.org/manual/latest/faq/why-is-the-exception-null-when-i-use-onexception.html]
states that {{exchange.getException()}} returns {{null}} if {{onException()}}
is used in conjunction with {{handled(true)}}.
Whether it's handled or not, {{exchange.getException()}} return always {{null}}
since the default error handling mechanism clears the exception already:
{code:java|title=RedeliveryErrorHandler.deliverToFailureProcessor() - Camel
2.25.0}
// we did not success with the redelivery so now we let the failure processor
handle it
// clear exception as we let the failure processor handle it
exchange.setException(null);
{code}
I'm fairly new too Camel error handling, it would've been helpful in advance to
know it.
References:
* [Exception in Exchange is
null|https://camel.465427.n5.nabble.com/Exception-in-Exchange-is-null-td5717324.html]
* [Apache Camel: exchange.getException() vs CamelExceptionCaught
property|https://stackoverflow.com/q/37422568/5006866]
--
This message was sent by Atlassian Jira
(v8.3.4#803005)