[DB-SIG] db module wrapper

Stuart Bishop stuart at stuartbishop.net
Tue Sep 7 18:29:31 CEST 2004


On 21/08/2004, at 6:59 AM, Randall Smith wrote:

> On a separate topic, got any ideas on how to abstract exceptions?  If 
> someone has already figured out an easy way to do this, I sure would 
> appreciate the knowledge.

Present them on the connection or cursor object:

con = dball.connect('whatever')
cur = con.cursor()
try:
	cur.execute('SOLECT * FROM BAR')
except cur.DatabaseError:
	print 'Oops'

Manipulating the base classes of the exception should also work,
since Exceptions are still old-style classes.

--  
Stuart Bishop <stuart at stuartbishop.net>
http://www.stuartbishop.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/db-sig/attachments/20040908/1e563802/PGP.pgp


More information about the DB-SIG mailing list