Skip to content

Commit

Permalink
fix: Fix compactibility of exception with Milvus 2.2.x
Browse files Browse the repository at this point in the history
Signed-off-by: bigsheeper <[email protected]>
  • Loading branch information
bigsheeper committed Dec 2, 2023
1 parent d58447a commit 1fbaac4
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 86 deletions.
12 changes: 6 additions & 6 deletions pymilvus/client/asynch.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def exception(self):

class SearchFuture(Future):
def on_response(self, response: milvus_pb2.SearchResults):
if response.status.code == 0:
if response.status.code == 0 and response.status.error_code == 0:
return SearchResult(response.results)

status = response.status
Expand All @@ -172,7 +172,7 @@ def on_response(self, response: milvus_pb2.SearchResults):
class MutationFuture(Future):
def on_response(self, response: Any):
status = response.status
if status.code == 0:
if status.code == 0 and status.error_code == 0:
return MutationResult(response)

status = response.status
Expand All @@ -181,7 +181,7 @@ def on_response(self, response: Any):

class CreateIndexFuture(Future):
def on_response(self, response: Any):
if response.code != 0:
if response.code != 0 or response.error_code != 0:
raise MilvusException(response.code, response.reason, response.error_code)

return Status(response.code, response.reason)
Expand Down Expand Up @@ -244,19 +244,19 @@ def exception(self):

class FlushFuture(Future):
def on_response(self, response: Any):
if response.status.code != 0:
if response.status.code != 0 or response.status.error_code != 0:
raise MilvusException(
response.status.code, response.status.reason, response.status.error_code
)


class LoadCollectionFuture(Future):
def on_response(self, response: Any):
if response.code != 0:
if response.code != 0 or response.error_code != 0:
raise MilvusException(response.code, response.reason, response.error_code)


class LoadPartitionsFuture(Future):
def on_response(self, response: Any):
if response.code != 0:
if response.code != 0 or response.error_code != 0:
raise MilvusException(response.code, response.reason, response.error_code)
Loading

0 comments on commit 1fbaac4

Please sign in to comment.