Skip to content

Commit

Permalink
Fix INDEX_NOT_EXIST error code (#1736)
Browse files Browse the repository at this point in the history
See also: milvus-io/milvus#27624

Signed-off-by: yangxuan <[email protected]>
  • Loading branch information
XuanYang-cn authored Oct 16, 2023
1 parent c4a05a7 commit 9ad3541
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pymilvus/client/grpc_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ def list_indexes(self, collection_name: str, timeout: Optional[float] = None, **
status = response.status
if status.code == 0:
return response.index_descriptions
if status.code == Status.INDEX_NOT_EXIST:
if status.code == ErrorCode.INDEX_NOT_FOUND or status.error_code == Status.INDEX_NOT_EXIST:
return []
raise MilvusException(status.code, status.reason, status.error_code)

Expand All @@ -930,7 +930,7 @@ def describe_index(
rf = self._stub.DescribeIndex.future(request, timeout=timeout)
response = rf.result()
status = response.status
if status.code == Status.INDEX_NOT_EXIST:
if status.code == ErrorCode.INDEX_NOT_FOUND or status.error_code == Status.INDEX_NOT_EXIST:
return None
if status.code != 0:
raise MilvusException(status.code, status.reason)
Expand Down
1 change: 1 addition & 0 deletions pymilvus/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class ErrorCode(IntEnum):
RATE_LIMIT = 8
FORCE_DENY = 9
COLLECTION_NOT_FOUND = 100
INDEX_NOT_FOUND = 700


class MilvusException(Exception):
Expand Down

0 comments on commit 9ad3541

Please sign in to comment.