Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 72212 invoked from network); 11 Nov 2009 07:11:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 11 Nov 2009 07:11:49 -0000 Received: (qmail 23487 invoked by uid 500); 11 Nov 2009 07:11:48 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 23418 invoked by uid 500); 11 Nov 2009 07:11:48 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 23408 invoked by uid 99); 11 Nov 2009 07:11:48 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Nov 2009 07:11:48 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of claus.ibsen@gmail.com designates 209.85.218.211 as permitted sender) Received: from [209.85.218.211] (HELO mail-bw0-f211.google.com) (209.85.218.211) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Nov 2009 07:11:37 +0000 Received: by bwz3 with SMTP id 3so803653bwz.36 for ; Tue, 10 Nov 2009 23:11:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=oTcuoVl9cYZV64vhlcvKKIL6SB8du83ymN2J7OpK6qg=; b=OhP7xzeLiDfsnsUSWRqRffH0/sYvnjxbdbyc9iFqQTJcZ5aVXQ6M0rx+J2fz1hb9Wo qfHJp6UfTESFSoriFU/dAfSfCUrbjvOo6xSIPH42t6uTVk5eOnGMHk0OTBH3bCNe/g/P lhXCigJ0h06mWqt8ZDGNwU0WWJmTvUdn0vTuY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=Ln0Iy54hESBgqAIoHB01w4Mof2XBMzN2mPoViQNISOQc7qHWGIqHaeLAE3H8uBHIac qBh2C1qMwolyzP0bfvlefIW+HJ83xELzGbG/t7PzZumHDvb4AJMd78o5cE7WL8RI7Uk2 +8YCQLp66Cy4hzCefWxbuzRgO0TpUZ+Z0WhCc= MIME-Version: 1.0 Received: by 10.204.143.151 with SMTP id v23mr1061090bku.169.1257923477417; Tue, 10 Nov 2009 23:11:17 -0800 (PST) In-Reply-To: <26281107.post@talk.nabble.com> References: <26215607.post@talk.nabble.com> <5380c69c0911050654j191e5e10taf050290759bdec5@mail.gmail.com> <26222792.post@talk.nabble.com> <4AF51D9D.6020602@die-schneider.net> <5380c69c0911062319x18b94199k1beafb0a0c3e6e87@mail.gmail.com> <26271839.post@talk.nabble.com> <4AF871FE.601@die-schneider.net> <26281107.post@talk.nabble.com> From: Claus Ibsen Date: Wed, 11 Nov 2009 08:10:57 +0100 Message-ID: <5380c69c0911102310m2e1c6989w39303d57f1ebe70c@mail.gmail.com> Subject: Re: Exception handling ... onException To: users@camel.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org 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 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. > > > =A0 =A0 =A0 =A0onException(UnmarshalException.class) > =A0 =A0 =A0 =A0.useOriginalBody() > =A0 =A0 =A0 =A0.handled(true) > =A0 =A0 =A0 =A0 =A0 =A0.to("log:onException(UnmarshalException.class)?lev= el=3DINFO") > =A0 =A0 =A0 =A0.end(); > > =A0 =A0 =A0 =A0onException(Exception.class) > =A0 =A0 =A0 =A0.useOriginalBody() > =A0 =A0 =A0 =A0.handled(true) > =A0 =A0 =A0 =A0 =A0 =A0.to("log:onException(Exception.class)?level=3DINFO= ") > =A0 =A0 =A0 =A0.end(); > > =A0 =A0 =A0 =A0from("activemq:publish?exchangePattern=3DInOnly&transacted= =3Dtrue") > =A0 =A0 =A0 =A0 =A0 =A0.routeId(Publish2CenterRouteBuilder.ROUTE_ID) > =A0 =A0 =A0 =A0 =A0 =A0.transacted() > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0.process(new Publish2CenterProcessor()) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0.multicast() > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0.pipeline() > > .to("activemq:BonData?exchangePattern=3DInOnly&transacted=3Dtrue") > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0.end() > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0.pipeline() > > .to("activemq:NonBonData?exchangePattern=3DInOnly&transacted=3Dtrue") > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0.end() > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 .end() > =A0 =A0 =A0 =A0.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)!! > > > =A0 =A0 =A0 =A0throw 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 excepti= on > 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" =A0and 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. > > --=20 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