[Zope] ZSQL Errors

Joel Burton joel@joelburton.com
Tue, 19 Mar 2002 10:50:30 -0500


<dtml-try>
  <dtml-in select>
    <dtml-var show>
  </dtml-in>
<dtml-except>
  <dtml-var error_value>
</dtml-try>

If there's an SQL error raised by PostgreSQL, you'll get the error message
in error_value.
If you don't use the try/except wrap, Zope will raise an error which shows
the PG error.

Zope 2.5.0; PG 7.3cvs (but should be the same w/earlier versions of PG). I'm
using zpysopg; this might be quite different with other PG adapters.


Joel BURTON | joel@joelburton.com | joelburton.com | aim: wjoelburton
Knowledge Management & Technology Consultant

> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Colin
> Fox
> Sent: Monday, March 18, 2002 10:51 PM
> To: zope@zope.org
> Subject: [Zope] ZSQL Errors
>
>
> I'm developing a zope app that uses an external database (Postgres) for
> its back end. It works great when it's working, but if there's an error,
> I don't know how to print the error message.
>
> I can't find any documentation on how to get the sql error that was
> generated by the database. That makes debugging very time consuming.
>
> The only example I could find just uses a generic dtml exception
> handler, which doesn't print the error string.
>
> Does anyone have any docs/examples on this?
>
> Thanks!
>
> --
> Colin Fox                                       cfox@crystalcherry.com
> CF Consulting Inc.                                    GPG Fingerprint:
>                     D8F0 84E7 E7CC 5C6C 9982  F1A7 A3EB 6EA3 BC97 572F
>