If some SQL query fails, log the whole query.
bzr revid: p_christ@hol.gr-20081215220606-l9mncs9qnyy0v7tv
This commit is contained in:
+6
-1
@@ -118,7 +118,12 @@ class Cursor(object):
|
||||
if self.sql_log:
|
||||
now = mdt.now()
|
||||
|
||||
res = self._obj.execute(query, p or None)
|
||||
try:
|
||||
res = self._obj.execute(query, p or None)
|
||||
except psycopg2.ProgrammingError, pe:
|
||||
logger= netsvc.Logger()
|
||||
logger.notifyChannel('sql_db', netsvc.LOG_ERROR, "Programming error: %s, in query %s" % (pe, query))
|
||||
raise
|
||||
|
||||
if self.sql_log:
|
||||
log("query: %s" % self._obj.query)
|
||||
|
||||
Reference in New Issue
Block a user