add error handler for dbapi. when there is an exception in the db

layer, this handler gets called instead of after_execute.
This commit is contained in:
Tim Daly, Jr 2013-05-15 01:23:29 +00:00
parent 6a8b5d59e7
commit 41de145487

View File

@ -132,7 +132,14 @@ def after_execute(name):
if not config.db_tracing_enabled:
return
stop('execute')
pass
return handler
def dbapi_error(name):
def handler(conn, cursor, statement, parameters, context, exception):
if not config.db_tracing_enabled:
return
annotate('database exception {0}'.format(exception))
stop('execute')
return handler
## http helpers