if you don't want the error to propagate back up, then set handled(true) in
your doCatch() block...

also, don't try to mix try/catch with onException handling of the same error
class...just pick one or the other


jeff wrote
> Hey !
> 
> I am trying to catch exception from validation properly.
> 
> In a main from route I do :
> 
> from ...
> [...]
> .doTry()
> .to("direct:validationAED")
> .doCatch(PredicateValidationException.class)
> .to("direct:erreurFormatAEDFonctionnelZone")
> .doFinally()
> [...]
> With an :
> 
> *from("direct:validationAED")*
> * .validate(zonePredicate)*
> * .end();*
> *
> *
> *And  :*
> *
> *
> from("direct:erreurFormatAEDFonctionnelZone")*
> *
> .log("Error on   :  '${body}'  ")
> .end();
> 
> It works but I have polution :
> 
> org.apache.camel.processor.validation.PredicateValidationException:
> Validation failed for
> Predicate[com.mycomp.mediation.aed.ZonePredicate@c21990a]. Exchange[null]
> 
> In my log
> 
> I have play with :
> 
> onException(PredicateValidationException.class).handled(true / false)
> .to("mock:err") .end();
> 
> If I put false I continue to have log error and if I put true my
> direct:erreurFormatAEDFonctionnelZone is not called ...
> 
> 
> 
> Any idea of how solve this ?
> 
> Thanks !





-----
Ben O'Day
IT Consultant -http://consulting-notes.com

--
View this message in context: 
http://camel.465427.n5.nabble.com/Handle-exception-tp5728590p5728592.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to