Skip to content

Commit

Permalink
rbd: use internal as default error code in getGRPCError()
Browse files Browse the repository at this point in the history
This commit replaces codes.Unknown with codes.Internal
as the default error code in getGRPCError().

Signed-off-by: Rakshith R <rar@redhat.com>
  • Loading branch information
Rakshith-R committed Jun 10, 2024
1 parent b715bbe commit 376b35a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions internal/csi-addons/rbd/replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -792,8 +792,8 @@ func getGRPCError(err error) error {
}
}

// Handle any other non nil error not listed in the map
return status.Error(codes.Unknown, err.Error())
// Handle any other non nil error not listed in the map as internal error
return status.Error(codes.Internal, err.Error())
}

// GetVolumeReplicationInfo extracts the RBD volume information from the volumeID, If the
Expand Down
2 changes: 1 addition & 1 deletion internal/csi-addons/rbd/replication_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ func TestGetGRPCError(t *testing.T) {
{
name: "InvalidError",
err: errors.New("some error"),
expectedErr: status.Error(codes.Unknown, "some error"),
expectedErr: status.Error(codes.Internal, "some error"),
},
{
name: "NilError",
Expand Down

0 comments on commit 376b35a

Please sign in to comment.