Throwable e = exchange.getException();
// set the original caused exception
exchange.setProperty(EXCEPTION_CAUSE_PROPERTY, e);
// find the error handler to use (if any)
ExceptionType exceptionPolicy = getExceptionPolicy(exchange, e);
if (exceptionPolicy != null) {
data.currentRedeliveryPolicy = exceptionPolicy.createRedeliveryPolicy(exchange.getContext(), data.currentRedeliveryPolicy);
data.handledPredicate = exceptionPolicy.getHandledPolicy();
Processor processor = exceptionPolicy.getErrorHandler();
if (processor != null) {
data.failureProcessor = processor;
}
}