Good to know. I will add a remark within the documentation. On Tue, Oct 21, 2014 at 8:43 AM, Willem Jiang <willem.ji...@gmail.com> wrote:
> ChoiceDefinition doesn’t extends the OutputDefinition, which means you > cannot define the doCatch after the ChoiceDefinition. > If you want to catch the exception inside of ChoiceDefinition, you can use > error handler or use doTry…doCatch inside of when part. > > -- > Willem Jiang > > Red Hat, Inc. > Web: http://www.redhat.com > Blog: http://willemjiang.blogspot.com (English) > http://jnn.iteye.com (Chinese) > Twitter: willemjiang > Weibo: 姜宁willem > > > > On October 16, 2014 at 2:59:29 PM, Charles Moulliard (ch0...@gmail.com) > wrote: > > Hi, > > > > Does somebody knows why this syntax is not accepted > > > > from("direct:wayne-get-token").setExchangePattern(ExchangePattern.InOut) > > .doTry() > > .to("https4://wayne-token-service") > > .choice() > > .when().simple("${header.CamelHttpResponseCode} == '200'") > > .convertBodyTo(String.class) > > .setHeader("wayne-token").groovy("body.replaceAll('\"','')") > > .log(">> Wayne Token : ${header.wayne-token}") > > .endChoice() > > .doCatch(Exception.class) ////// --> CANNOT RESOLVE METHOD > > doCatch(java.lang.Class (java.lang.Exception>) > > .log(">> Exception") > > .endDoTry(); > > > > but well this one > > > > > > from("direct:wayne-get-token").setExchangePattern(ExchangePattern.InOut) > > .doTry() > > .to("https4://wayne-token-service") > > .doCatch(Exception.class) > > .log(">> Exception") > > .endDoTry(); > > > > Regards, > > > > Charles > > > > -- Charles Moulliard Apache Committer / Architect @RedHat Twitter : @cmoulliard | Blog : http://cmoulliard.github.io