add error log message if raise exception on database connect
authorTristan Hill (credativ) <>
Wed, 24 Nov 2010 09:41:33 +0000 (15:11 +0530)
committerYogesh Sakhreliya <ysa@tinyerp.com>
Wed, 24 Nov 2010 09:41:33 +0000 (15:11 +0530)
bzr revid: ysa@tinyerp.com-20101124094133-ayl5pppdjqkx534q

bin/sql_db.py

index 6c2c17b..feafc72 100644 (file)
@@ -290,7 +290,11 @@ class ConnectionPool(object):
                 # note: this code is called only if the for loop has completed (no break)
                 raise PoolError('The Connection Pool Is Full')
 
-        result = psycopg2.connect(dsn=dsn, connection_factory=PsycoConnection)
+        try:
+            result = psycopg2.connect(dsn=dsn, connection_factory=PsycoConnection)
+        except psycopg2.Error, e:
+            self.__logger.log(logging.ERROR, 'connect:%s', e)
+            raise
         self._connections.append((result, True))
         self._debug('Create new connection')
         return result