]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- psycopg2 can raise un-str()able exceptions; don't croak when trying to log them
authorJason Kirtland <jek@discorporate.us>
Fri, 8 Feb 2008 20:38:28 +0000 (20:38 +0000)
committerJason Kirtland <jek@discorporate.us>
Fri, 8 Feb 2008 20:38:28 +0000 (20:38 +0000)
lib/sqlalchemy/pool.py

index d177dc10d58f15dfee612e1e76a0c21e95510cf9..aa30e2a2a0b3d36604c3e631d2b698c8c9cd3649 100644 (file)
@@ -430,7 +430,12 @@ class _CursorFairy(object):
         try:
             self.cursor.close()
         except Exception, e:
-            self.__parent._logger.warn("Error closing cursor: " + e)
+            try:
+                ex_text = str(e)
+            except TypeError:
+                ex_text = repr(e)
+            self.__parent._logger.warn("Error closing cursor: " + ex_text)
+
             if isinstance(e, (SystemExit, KeyboardInterrupt)):
                 raise