Remove duplicate error in switch case. (#7381)

Fixes: #7380

crypto.ErrInvalidCustomerKey was being handled twice in toAPIErrorCode()
master
poornas 6 years ago committed by kannappanr
parent 6bc0de2a75
commit 12b79d9f3b
  1. 2
      cmd/api-errors.go
  2. 2
      cmd/api-errors_test.go

@ -1507,8 +1507,6 @@ func toAPIErrorCode(ctx context.Context, err error) (apiErr APIErrorCode) {
apiErr = ErrInvalidEncryptionMethod apiErr = ErrInvalidEncryptionMethod
case crypto.ErrInvalidCustomerAlgorithm: case crypto.ErrInvalidCustomerAlgorithm:
apiErr = ErrInvalidSSECustomerAlgorithm apiErr = ErrInvalidSSECustomerAlgorithm
case crypto.ErrInvalidCustomerKey:
apiErr = ErrInvalidSSECustomerKey
case crypto.ErrMissingCustomerKey: case crypto.ErrMissingCustomerKey:
apiErr = ErrMissingSSECustomerKey apiErr = ErrMissingSSECustomerKey
case crypto.ErrMissingCustomerKeyMD5: case crypto.ErrMissingCustomerKeyMD5:

@ -55,7 +55,7 @@ var toAPIErrorTests = []struct {
// SSE-C errors // SSE-C errors
{err: crypto.ErrInvalidCustomerAlgorithm, errCode: ErrInvalidSSECustomerAlgorithm}, {err: crypto.ErrInvalidCustomerAlgorithm, errCode: ErrInvalidSSECustomerAlgorithm},
{err: crypto.ErrMissingCustomerKey, errCode: ErrMissingSSECustomerKey}, {err: crypto.ErrMissingCustomerKey, errCode: ErrMissingSSECustomerKey},
{err: crypto.ErrInvalidCustomerKey, errCode: ErrInvalidSSECustomerKey}, {err: crypto.ErrInvalidCustomerKey, errCode: ErrAccessDenied},
{err: crypto.ErrMissingCustomerKeyMD5, errCode: ErrMissingSSECustomerKeyMD5}, {err: crypto.ErrMissingCustomerKeyMD5, errCode: ErrMissingSSECustomerKeyMD5},
{err: crypto.ErrCustomerKeyMD5Mismatch, errCode: ErrSSECustomerKeyMD5Mismatch}, {err: crypto.ErrCustomerKeyMD5Mismatch, errCode: ErrSSECustomerKeyMD5Mismatch},
{err: errObjectTampered, errCode: ErrObjectTampered}, {err: errObjectTampered, errCode: ErrObjectTampered},

Loading…
Cancel
Save