patch: clean up exception formatting - Mailing list pgsql-jdbc

From Oliver Jowett
Subject patch: clean up exception formatting
Date
Msg-id 20030720044627.GA32403@opencloud.com
Whole thread Raw
Responses Re: patch: clean up exception formatting  (Barry Lind <blind@xythos.com>)
List pgsql-jdbc
The attached patch (against CVS HEAD) cleans up exception messages in two
areas:

1. Remove PSQLException's override of toString() so that the exception
classname is included in the output of toString() (i.e. the default
Throwable behaviour). Previously a .toString() on a PSQLException produces
something like:

   "Parameter index out of range."

With this patch you get the consistent-with-everything-else result:

  "org.postgresql.util.PSQLException: Parameter index out of range."

2. Strip whitespace from backend-generated errors when using them as an
exception message. Previously, you'd get tracebacks with odd blank lines:

  java.sql.SQLException: ERROR:  parser: parse error at or near "null" at character 27

     at org.postgresql.core.QueryExecutor.executeV2(QueryExecutor.java:286)
     at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:104)

With this patch you get the expected form:

  java.sql.SQLException: ERROR:  parser: parse error at or near "null" at character 27
     at org.postgresql.core.QueryExecutor.executeV2(QueryExecutor.java:286)
     at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:104)

-O

Attachment

pgsql-jdbc by date:

Previous
From: Oliver Jowett
Date:
Subject: patch: fix skeleton code in test README
Next
From: pginfo
Date:
Subject: Re: jdbc batch performance problem