[session] add session id to closed connection errors
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 18 Jul 2011 15:48:34 +0200
changeset 7665 0cd299c16f12
parent 7664 e286216515d6
child 7666 8644c2a065f0
[session] add session id to closed connection errors
dbapi.py
server/session.py
--- a/dbapi.py	Mon Jul 18 15:48:09 2011 +0200
+++ b/dbapi.py	Mon Jul 18 15:48:34 2011 +0200
@@ -483,7 +483,7 @@
 def check_not_closed(func):
     def decorator(self, *args, **kwargs):
         if self._closed is not None:
-            raise ProgrammingError('Closed connection')
+            raise ProgrammingError('Closed connection %s' % self.sessionid)
         return func(self, *args, **kwargs)
     return decorator
 
--- a/server/session.py	Mon Jul 18 15:48:09 2011 +0200
+++ b/server/session.py	Mon Jul 18 15:48:34 2011 +0200
@@ -758,7 +758,7 @@
         """connections set, set according to transaction mode for each query"""
         if self._closed:
             self.free_cnxset(True)
-            raise Exception('try to access connections set on a closed session')
+            raise Exception('try to access connections set on a closed session %s' % self.id)
         return getattr(self._threaddata, 'cnxset', None)
 
     def set_cnxset(self):
@@ -766,7 +766,7 @@
         with self._closed_lock:
             if self._closed:
                 self.free_cnxset(True)
-                raise Exception('try to set connections set on a closed session')
+                raise Exception('try to set connections set on a closed session %s' % self.id)
             if self.cnxset is None:
                 # get connections set first to avoid race-condition
                 self._threaddata.cnxset = cnxset = self.repo._get_cnxset()