patch: clean up exception formatting

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: patch: clean up exception formatting
Date: 2003-07-20 04:46:27
Message-ID: 20030720044627.GA32403@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
pgsql-exception_cleanup.txt text/plain 2.1 KB

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message pginfo 2003-07-20 05:00:19 Re: jdbc batch performance problem
Previous Message Tom Lane 2003-07-20 04:42:17 Re: column doesn't get calculated - updated