Hi, It is not working gloably but for each route it works if you describe a onException clause.
A working example : rest(...) .post("/{CamelMongoDbCollection}").description("Save operation") .route() .process(new MRCProcessor()) .to(String.format(mongoDBRoute, MongoDbOperation.insert)) .process(new MRCOutProcessor()) .onException(CamelMongoDbException.class).handled(true).process(new MRCErrorProcessor()) .endRest() Best regards On Sat, Oct 25, 2014 at 1:18 PM, Claus Ibsen <claus.ib...@gmail.com> wrote: > Hi > > Yeah I think unfortunately that onException, and interceptor etc isnt > supported in nested routes with the rest dsl. We will get this fixed > in the next patch release. I logged a ticket > https://issues.apache.org/jira/browse/CAMEL-7959 > > On Tue, Oct 7, 2014 at 12:04 PM, leon <itsmrch...@gmail.com> wrote: > > Hi all, > > > > I am using camel 2.14.0 and the new rest dsl feature. It seems exception > > clause is not working with rest dsl. Am I doing anything wrong? Here are > my > > classes: > > > > public MyRouteBuilder extends RouteBuilder { > > public void configure() throws Exception { > > > > restConfiguration.component("servlet").bindingMode(RestBindingMode.json); > > onException(RuntimeException.class).process(new > > MyProcessor()).stop(); > > rest("/test") > > .get("/error") > > .route() > > .bean(MyClassRaiseException.class, "test"); > > } > > } > > > > public MyClassRaiseException { > > public void test() { > > throws new RuntimeException("TEST"); > > } > > } > > > > public MyProcessor implements Processor { > > public void process(Exchange exchange) throws Exception { > > System.out.println("This line of code is not called"); > > } > > } > > > > MyProcessor is not get called. Helps are needed please!! > > > > Kind regards, > > Leon Chang > > > > > > > > -- > > View this message in context: > http://camel.465427.n5.nabble.com/Can-exception-clause-works-with-rest-dsl-in-camel-2-14-0-tp5757381.html > > Sent from the Camel - Users mailing list archive at Nabble.com. > > > > -- > 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/ >