Hi I had a look and created a ticket to improve/fix this issue https://issues.apache.org/activemq/browse/CAMEL-2158
The current code did stop to eagerly instead of finding better candidates longer up the exception hierarchy. On Tue, Nov 10, 2009 at 11:19 AM, DRy <dirk.rybin...@itellium.com> wrote: > > Hi, > > I think I've got it ... > > On my RouteBuilder-class (see below) I try to catch UnmarshalException in > one and all other excpetions in the other onException call. > > > onException(UnmarshalException.class) > .useOriginalBody() > .handled(true) > .to("log:onException(UnmarshalException.class)?level=INFO") > .end(); > > onException(Exception.class) > .useOriginalBody() > .handled(true) > .to("log:onException(Exception.class)?level=INFO") > .end(); > > from("activemq:publish?exchangePattern=InOnly&transacted=true") > .routeId(Publish2CenterRouteBuilder.ROUTE_ID) > .transacted() > .process(new Publish2CenterProcessor()) > .multicast() > .pipeline() > > .to("activemq:BonData?exchangePattern=InOnly&transacted=true") > .end() > .pipeline() > > .to("activemq:NonBonData?exchangePattern=InOnly&transacted=true") > .end() > .end() > .end(); > > > In my processor/bean (Publish2CenterProcessor) if a UnmarshalException is > thrown I use the constructor that put in a nested exception (in that case a > XMLException from XMLBeans)!! > > > throw new UnmarshalException("Could not unmarshal body to XML3!", > exception); > > > As descriped in http://camel.apache.org/exception-clause.html camel will > "start from the bottom (nested caused by) and recursive up in the exception > hierarchy to find the first matching onException clause". In my case the > nested exception (XMLException) will be testet against UnmarshalException > (no match) and next against Exception (match). So the intended > UnmarshalException will endup in onException(Exception.class). > > Why does camel test "from the bottom (nested caused by) and recursive up in > the exception hierarchy" and not vise versa ... ? > > > ... DRy > > -- > View this message in context: > http://old.nabble.com/Exception-handling-...-onException-tp26215607p26281107.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus