Comment 3 for bug 1025264

Revision history for this message
Stuart Bishop (stub) wrote :

It looks like we don't reraise failures when constructing Stores as DisconnectionErrors.

stub@aargh:~/lp/replication$ python
Python 2.7.3 (default, Aug 1 2012, 05:14:39)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from storm.locals import *
>>> db = create_database('postgres://localhost:6666/whatever')
>>> from storm.exceptions import DisconnectionError
>>> try:
... store = Store(db)
... except DisconnectionError:
... print 'storm exception'
...
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "/usr/local/lib/python2.7/dist-packages/storm-0.19-py2.7-linux-x86_64.egg/storm/store.py", line 73, in __init__
    self._connection = database.connect(self._event)
  File "/usr/local/lib/python2.7/dist-packages/storm-0.19-py2.7-linux-x86_64.egg/storm/database.py", line 410, in connect
    return self.connection_factory(self, event)
  File "/usr/local/lib/python2.7/dist-packages/storm-0.19-py2.7-linux-x86_64.egg/storm/database.py", line 185, in __init__
    self._raw_connection = self._database.raw_connect()
  File "/usr/local/lib/python2.7/dist-packages/storm-0.19-py2.7-linux-x86_64.egg/storm/databases/postgres.py", line 329, in raw_connect
    raw_connection = psycopg2.connect(self._dsn)
  File "/usr/lib/python2.7/dist-packages/psycopg2/__init__.py", line 179, in connect
    connection_factory=connection_factory, async=async)
psycopg2.OperationalError: could not connect to server: Connection refused
 Is the server running on host "localhost" (127.0.0.1) and accepting
 TCP/IP connections on port 6666?