Skip to content

Commit

Permalink
Merge pull request #178 from xoanmi/master
Browse files Browse the repository at this point in the history
FIX: Add error control on  the `GetReplicationPolicyByName()`
  • Loading branch information
elenz97 authored Sep 12, 2023
2 parents 445c36d + c0a57b9 commit e174a12
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apiv2/pkg/clients/replication/replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,11 @@ func (c *RESTClient) GetReplicationPolicyByName(ctx context.Context, name string
return nil, err
}

if len(policies) > 1 {
switch {
case len(policies) > 1:
return nil, &errors.ErrMultipleResults{}
case len(policies) == 0:
return nil, &errors.ErrNotFound{}
}

return policies[0], nil
Expand Down

0 comments on commit e174a12

Please sign in to comment.