@@ -253,6 +253,8 @@ async def get_card(
253253 """
254254 # If we don't have the public card, try to get that first.
255255 card = self .agent_card
256+ if card is None and not self ._needs_extended_card :
257+ raise ValueError ('Agent card is not available.' )
256258
257259 if not self ._needs_extended_card :
258260 return card
@@ -278,7 +280,7 @@ def __init__(
278280 ):
279281 super ().__init__ (consumers , middleware )
280282 if not config .grpc_channel_factory :
281- raise Exception ('GRPC client requires channel factory.' )
283+ raise ValueError ('GRPC client requires channel factory.' )
282284 self ._card = card
283285 self ._config = config
284286 # Defer init to first use.
@@ -452,9 +454,16 @@ async def resubscribe(
452454 Exception: If streaming is not supported by the client or server.
453455 """
454456 if not self ._config .streaming or not self ._card .capabilities .streaming :
455- raise Exception (
457+ raise NotImplementedError (
456458 'client and/or server do not support resubscription.'
457459 )
460+ if not self ._transport_client :
461+ raise ValueError ('Transport client is not initialized.' )
462+ if not hasattr (self ._transport_client , 'resubscribe' ):
463+ # This can happen if the proto definitions are out of date or the method is missing
464+ raise NotImplementedError (
465+ 'Resubscribe is not implemented on the gRPC transport client.'
466+ )
458467 async for event in self ._transport_client .resubscribe (
459468 request ,
460469 context = context ,
0 commit comments