Re: Minor Feature Request - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: Minor Feature Request
Date
Msg-id 42531BD3.80801@opencloud.com
Whole thread Raw
In response to Re: Minor Feature Request  (Kris Jurka <books@ejurka.com>)
Responses Re: Minor Feature Request
Re: Minor Feature Request
List pgsql-jdbc
Kris Jurka wrote:
>
> On Wed, 6 Apr 2005, Oliver Jowett wrote:
>
>
>>Perhaps we should put accessors for the various message parts on
>>PSQLException, but leave the SQLException message as it currently is.
>>
>
>
> This could work for a pg specific admin tool or client, but not a
> generic/portable java client.

Right, but aren't we talking about a client that knows about postgresql
internals anyway? There's no concept of line numbers, hints, etc.
associated with an exception in standard JDBC anyway, and as you said
it's not obvious what is useful to have in the error message for
standard clients.

Niels was talking about putting the line number into the message, then
parsing the message to get this info. That seems pretty horrible since
then you have lots of extra work in the app, and the app is still
postgresql-specific.. It seems much cleaner if it can just do something
like:

  try {
    // ...
  } catch (PSQLException e) {
    if (e instanceof PSQLException)
      linenumber = ((PSQLException)e).getLineNumber();
    else
      linenumber = -1;

    // handle exception
  }

-O

pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: Minor Feature Request
Next
From: Oliver Jowett
Date:
Subject: Re: Minor Feature Request