Hi You should use endTry instead of endChoice to get back to try .. catch scope. Though it requires a little code change as well to work in camel-core. So I logged a ticket https://issues.apache.org/jira/browse/CAMEL-7958
On Tue, Oct 21, 2014 at 9:08 AM, Charles Moulliard <ch0...@gmail.com> wrote: > 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 -- Claus Ibsen ----------------- Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/