X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AF24D52C55 for ; Wed, 27 Jul 2005 02:13:48 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 32547-08 for ; Wed, 27 Jul 2005 05:13:40 +0000 (GMT) Received: from mail102.csoft.net (lilly.csoft.net [63.111.22.101]) by svr1.postgresql.org (Postfix) with SMTP id A192F52C48 for ; Wed, 27 Jul 2005 02:13:39 -0300 (ADT) Received: (qmail 31027 invoked by uid 3922); 27 Jul 2005 05:13:39 -0000 Date: Wed, 27 Jul 2005 01:13:39 -0400 (EDT) From: Michael Allman To: Oliver Jowett Cc: pgsql-jdbc@postgresql.org Subject: Re: jdbc xa patches In-Reply-To: <42E70EFE.20600@opencloud.com> Message-ID: <20050727011008.W74424@yvyyl> References: <20050726193540.M74424@yvyyl> <42E6D231.8090002@opencloud.com> <42E6E2AD.9010104@opencloud.com> <20050726232828.S74424@yvyyl> <42E70EFE.20600@opencloud.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200507/351 X-Sequence-Number: 13499 On Wed, 27 Jul 2005, Oliver Jowett wrote: > Michael Allman wrote: >> On Wed, 27 Jul 2005, Oliver Jowett wrote: >> >>> More generally: can we get XAExceptions thrown with useful messages? It >>> seems like there's no direct constructor that gives you both message and >>> error code, but the error code is a public field so you can set it after >>> construction before throwing. > >> Since the client of a PGXAResource instance is a transaction manager I see >> no benefit. The transaction manager will make a decision on what to do >> based on the code carried by XAException and carry on. Maybe it will log a >> message. > > I absolutely disagree with there being no benefit. We should provide as much > information as possible in the exception. All hhe TM *has* to log is the > exception we give it, really, so that better have all the information we can > give about any underlying problems. In cases where an XAException is thrown due to another exception, say SQLException, I believe I was consistent in writing the cause exception's stack trace to the DriverManager's log writer. I think that covers logging cause exceptions for the most part. I'm not really disputing that putting nice string messages in all our thrown exceptions is bad, just that in this particular use case it's probably not worth the effort. (The effort being dealing with the fact that XAException does not take an error code and string message at once.) Michael