translate grpc errors to RPCError
This commit is contained in:
parent
a799503c97
commit
270192486a
2 changed files with 5 additions and 2 deletions
|
@ -480,7 +480,10 @@ class Network:
|
||||||
async def new_claim_search(self, server, **kwargs):
|
async def new_claim_search(self, server, **kwargs):
|
||||||
async with grpc.aio.insecure_channel(server) as channel:
|
async with grpc.aio.insecure_channel(server) as channel:
|
||||||
stub = hub_pb2_grpc.HubStub(channel)
|
stub = hub_pb2_grpc.HubStub(channel)
|
||||||
response = await stub.Search(SearchRequest(**kwargs))
|
try:
|
||||||
|
response = await stub.Search(SearchRequest(**kwargs))
|
||||||
|
except grpc.aio.AioRpcError as error:
|
||||||
|
raise RPCError(error.code(), error.details())
|
||||||
return response
|
return response
|
||||||
|
|
||||||
async def sum_supports(self, server, **kwargs):
|
async def sum_supports(self, server, **kwargs):
|
||||||
|
|
|
@ -205,4 +205,4 @@ class TestStress(CommandTestCase):
|
||||||
await self.stream_create()
|
await self.stream_create()
|
||||||
with self.assertRaises(RPCError) as err:
|
with self.assertRaises(RPCError) as err:
|
||||||
await self.claim_search(not_channel_ids=[("%040x" % i) for i in range(8196)])
|
await self.claim_search(not_channel_ids=[("%040x" % i) for i in range(8196)])
|
||||||
self.assertEqual(err.exception.message, 'not_channel_ids cant be set for more than 2048 items.')
|
self.assertEqual(err.exception.message, 'not_channel_ids cant have more than 2048 items.')
|
||||||
|
|
Loading…
Add table
Reference in a new issue