def receive_message(self, operation, request_id): """Receive a raw BSON message or raise ConnectionFailure. If any exception is raised, the socket is closed. """ try: return receive_message(self.sock, operation, request_id) except BaseException as error: self._raise_connection_failure(error)