title: Apache Camel onException
body: <p>I want to catch all Exception from routes.</p>
  
  <p>I add this OnExeption :</p>
  
  <pre><code>onException(Exception.class).process(new MyFunctionFailureHandler()).stop();
  </code></pre>
  
  <p>Then, I create the class MyFunctionFailureHandler.</p>
  
  <pre><code>public class MyFunctionFailureHandler  implements Processor {
  
  @Override
  public void process(Exchange exchange) throws Exception {
      Throwable caused;
  
      caused = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Throwable.class);
  
      exchange.getContext().createProducerTemplate().send("mock:myerror", exchange);
     }
  
  }
  </code></pre>
  
  <p>Unfortunately, it doesn't work and I don't know why.</p>
  
  <p>if there is an Exception, the program must stop.</p>
  
  <p>How can I know why this code doesn't work!!</p>
  
  <p>Thanks.</p>