[Zope] SQL Error Handling from a Python Script

Dieter Maurer dieter@handshake.de
Wed, 10 Jul 2002 19:52:47 +0200


Colin Fox writes:
 > ...
 > So far, I can tell that if a ZSQL object has an error, it throws an
 > exception that is at least based on StandardError. But I don't know
 > exactly what exception it is, and I don't know how I can pull anything
 > intelligent out of it other than it's string representation.
That the difficulty of a framework keen to integrate everything.

   It does not know which exceptions are thrown by the integrated
   components.

   Each Python database connection package uses its own exceptions,
   and they package authors tend to increase the number of exceptions
   to improve specificity.

For SQL methods, most exceptions come from the database connection
package. Look at its documentation (this is not part of Zope!)
to find out which exceptions are raised.


Dieter