Camel HttpOperationFailedException not being caught
<p>I'm testing exception handling in Camel, and noticed an odd behaviour.  I have an http component with deliberately throws a 404 Error. Camel would then throw a <code>HttpOperationFailedException</code> created by <code>org.apache.camel.component.http.HttpProducer.populateHttpOperationFailedException</code>  I'm using onWhen to distinguish between different status codes:</p>

<p>This is a sample of the approach for a 404: </p>

<pre><code>onException(HttpOperationFailedException.class)
    .onWhen(new Predicate() {
        public boolean matches(Exchange exchange) {
            HttpOperationFailedException ex = exchange.getProperty(
                    Exchange.EXCEPTION_CAUGHT,
                    HttpOperationFailedException.class);
            logger.warn("*** 404 Error ***");
            return (ex.getStatusCode() == 404);
        }
    }).handled(true).maximumRedeliveries(0);
</code></pre>

<p>But it never gets executed. </p>

<p>So then I tried this:</p>

<pre><code>onException(Exception.class)
    .onWhen(new Predicate() {
        public boolean matches(Exchange exchange) {
            Object ex = exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
            logger.error(ex.getClass());
            return (true);
        }
    }).handled(true).maximumRedeliveries(0);
</code></pre>

<p>And the logger always shows <code>class org.apache.camel.http.common.HttpOperationFailedException</code></p>

<p>Any help would be great! I'm using Camel 2.17.1. </p>