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