Skip to content

Commit 844c041

Browse files
committed
throw error in registration
1 parent de63be6 commit 844c041

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

celestial/host.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
"""Adapter for communication with the Celestial hosts over gRPC"""
1919

20+
import os
2021
import typing
2122
import grpc
2223
import time
@@ -52,11 +53,16 @@ def register(self) -> proto.celestial.celestial_pb2.RegisterResponse:
5253
5354
:return: The response from the host.
5455
"""
55-
request = proto.celestial.celestial_pb2.RegisterRequest(host=self.num)
56+
try:
57+
request = proto.celestial.celestial_pb2.RegisterRequest(host=self.num)
5658

57-
response: proto.celestial.celestial_pb2.RegisterResponse = self.stub.Register(
58-
request
59-
)
59+
response: proto.celestial.celestial_pb2.RegisterResponse = (
60+
self.stub.Register(request)
61+
)
62+
63+
except grpc.RpcError as e:
64+
logging.error(f"Error registering host {self.num}: {e}")
65+
os.exit(1)
6066

6167
# others currently not used
6268
self.peer_public_key = response.peer_public_key

0 commit comments

Comments
 (0)