Comment 2 for bug 959699

Revision history for this message
William Grant (wgrant) wrote :

In the case of a pgbouncer disconnection during a rollback, psycopg2 2.2 raises a ProgrammingError with no message. That's hacked around in Storm:

        if isinstance(exc, disconnection_errors):
            # When the connection is closed by a termination of pgbouncer, a
            # ProgrammingError is raised. If the raw connection is closed we
            # assume it's actually a disconnection.
            if isinstance(exc, ProgrammingError):
                if self._raw_connection.closed:
                    return True

But 2.4.x (with the same libpq5) now returns a DatabaseError('error with no message from the libpq',), which isn't caught here. We might just be able to sensibly catch DatabaseError here.