[DB-SIG] db module wrapper

Randall Smith randall at tnr.cc
Fri Aug 20 23:53:20 CEST 2004


About exceptions.

I'm just throwing this out.  Tell me what you think.

By default, translate a native_module.Exception into a 
module_wrapper.Exception unless specified by module_wrapper.config that 
Exception1 should be converted to Exception2.  module_wrapper method 
will be able to catch exceptions and either claim them or transform 
them.  module_wrapper.config will have some option like

{'pyscopg_1.1.15': 'exc_trans execute DatebaseError ProgrammingError'}
Which means:  When the execute method raises a Database error, transform 
it to a Programming error.

Anything not specified in the config would simply transform from 
psycopg.Error to wrapper.Error

How does this approach sound?

Randall


More information about the DB-SIG mailing list