1
1
from typing import Optional , Sequence , cast
2
2
3
+ from grpc .aio import AioRpcError # type: ignore
4
+
3
5
from weaviate .collections .classes .config import ConsistencyLevel
4
6
from weaviate .collections .classes .tenants import TenantActivityStatus
5
7
from weaviate .collections .grpc .retry import _Retry
6
8
from weaviate .collections .grpc .shared import _BaseGRPC
7
9
from weaviate .connect import ConnectionV4
10
+ from weaviate .exceptions import WeaviateTenantGetError
8
11
from weaviate .proto .v1 import tenants_pb2
9
12
10
13
@@ -25,14 +28,18 @@ async def get(self, names: Optional[Sequence[str]]) -> tenants_pb2.TenantsGetRep
25
28
collection = self ._name ,
26
29
names = tenants_pb2 .TenantNames (values = names ) if names is not None else None ,
27
30
)
28
- res = await _Retry ().with_exponential_backoff (
29
- 0 ,
30
- f"Get tenants for collection { self ._name } " ,
31
- self ._connection .grpc_stub .TenantsGet ,
32
- request ,
33
- metadata = self ._connection .grpc_headers (),
34
- timeout = self ._connection .timeout_config .query ,
35
- )
31
+ try :
32
+ res = await _Retry ().with_exponential_backoff (
33
+ 0 ,
34
+ f"Get tenants for collection { self ._name } " ,
35
+ self ._connection .grpc_stub .TenantsGet ,
36
+ request ,
37
+ metadata = self ._connection .grpc_headers (),
38
+ timeout = self ._connection .timeout_config .query ,
39
+ )
40
+ except AioRpcError as e :
41
+ raise WeaviateTenantGetError (str (e ))
42
+
36
43
return cast (tenants_pb2 .TenantsGetReply , res )
37
44
38
45
def map_activity_status (self , status : tenants_pb2 .TenantActivityStatus ) -> TenantActivityStatus :
0 commit comments