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.
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) : connection. closed:
return True
# 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_
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.