But the rejected line stay in the route ... I have in my output line not validated by the process. Do you know how to ignore / skip not validate element passed to my error direct route ?
2013/3/5 Jean Francois LE BESCONT <jflebesc...@gmail.com> > Thanks ! > > Very helpfull ! > > I would this way to handle businessException : > > .doTry() > .process(new PredicateValidatingProcessor(zonePredicate)) > .doCatch(Exception.class).handled(true) > .to("direct:erreurFormatAEDZone") > .doFinally() > .to("mock:finally") > .end() > > > > 2013/3/5 boday <ben.o...@initekconsulting.com> > >> 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. >> > >