From 807bc64d3431502ee8279cbb2e8d5b21be404419 Mon Sep 17 00:00:00 2001 From: Tobias Pfandzelter Date: Tue, 11 Jun 2024 09:25:16 +0200 Subject: [PATCH] throw error in registration --- celestial/host.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/celestial/host.py b/celestial/host.py index fda1118..d6603b5 100644 --- a/celestial/host.py +++ b/celestial/host.py @@ -52,11 +52,16 @@ def register(self) -> proto.celestial.celestial_pb2.RegisterResponse: :return: The response from the host. """ - request = proto.celestial.celestial_pb2.RegisterRequest(host=self.num) + try: + request = proto.celestial.celestial_pb2.RegisterRequest(host=self.num) - response: proto.celestial.celestial_pb2.RegisterResponse = self.stub.Register( - request - ) + response: proto.celestial.celestial_pb2.RegisterResponse = ( + self.stub.Register(request) + ) + + except grpc.RpcError as e: + logging.error(f"Error registering host {self.num}: {e}") + exit(1) # others currently not used self.peer_public_key = response.peer_public_key