Skip to content

Commit

Permalink
fix: Return non-implemented error for connect
Browse files Browse the repository at this point in the history
When connect returns error and not unimplemented, this error is
swallowed and make bevavior confusing

Signed-off-by: Congqi Xia <[email protected]>
  • Loading branch information
congqixia committed Apr 9, 2024
1 parent e1a56c6 commit f5724dd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions client/grpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
"github.com/milvus-io/milvus-proto/go-api/v2/milvuspb"
"github.com/milvus-io/milvus-sdk-go/v2/common"
"github.com/milvus-io/milvus-sdk-go/v2/merr"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand Down Expand Up @@ -76,14 +77,14 @@ func (c *GrpcClient) connectInternal(ctx context.Context) error {
disableJSON |
disableParitionKey |
disableDynamicSchema)
return nil
}
return nil
}
return err
}

if resp.GetStatus().GetErrorCode() != commonpb.ErrorCode_Success {
return fmt.Errorf("connect fail, %s", resp.Status.Reason)
if !merr.Ok(resp.GetStatus()) {
return fmt.Errorf("connect fail, %s", resp.GetStatus().GetReason())
}

c.config.Identifier = strconv.FormatInt(resp.GetIdentifier(), 10)
Expand Down

0 comments on commit f5724dd

Please sign in to comment.