Edgewall Software

Version 2 (modified by Peter Suter, 11 years ago) ( diff )

Remove leftover notes that I added by mistake.

Exceptions

Custom Trac Exceptions

Trac defines a set of custom exception types:

DB Exceptions

We can catch Python DB API exceptions in a DB-neutral way. (Since Trac 1.0, see #6348.)

try: 
    with env.db_transaction as db: 
        ... 
except env.db_exc.IntegrityError, e: 
    ... 

The above example catches sqlite.IntegrityError, MySQLdb.IntegrityError or psycopg.IntegrityError, depending on the selected DatabaseBackend.

Note: See TracWiki for help on using the wiki.