diff --git a/asynch/proto/connection.py b/asynch/proto/connection.py index a599d742..dfbd134a 100644 --- a/asynch/proto/connection.py +++ b/asynch/proto/connection.py @@ -12,6 +12,7 @@ ServerException, UnexpectedPacketFromServerError, UnknownPacketFromServerError, + Error, ) from asynch.proto import constants from asynch.proto.block import ( @@ -580,7 +581,11 @@ async def connect(self): logger.debug("Connecting. Database: %s. User: %s", self.database, self.user) for host, port in self.hosts: logger.debug("Connecting to %s:%s", host, port) - return await self._init_connection(host, port) + try: + return await self._init_connection(host, port) + except Exception as err: + logger.error("Failed to connect to %s:%s, error: %s", host, port, err) + raise Error(f'All hosts unreachable: {self.hosts}') async def execute( self,