mirror of https://github.com/minio/minio.git
fix: errNoSuchPolicy should use errors.Is (#16656)
This commit is contained in:
parent
cd3a2de5a3
commit
b49b39e99d
|
@ -2001,8 +2001,6 @@ func toAPIErrorCode(ctx context.Context, err error) (apiErr APIErrorCode) {
|
||||||
apiErr = ErrAdminGroupNotEmpty
|
apiErr = ErrAdminGroupNotEmpty
|
||||||
case errNoSuchJob:
|
case errNoSuchJob:
|
||||||
apiErr = ErrAdminNoSuchJob
|
apiErr = ErrAdminNoSuchJob
|
||||||
case errNoSuchPolicy:
|
|
||||||
apiErr = ErrAdminNoSuchPolicy
|
|
||||||
case errNoPolicyToAttachOrDetach:
|
case errNoPolicyToAttachOrDetach:
|
||||||
apiErr = ErrAdminPolicyChangeAlreadyApplied
|
apiErr = ErrAdminPolicyChangeAlreadyApplied
|
||||||
case errSignatureMismatch:
|
case errSignatureMismatch:
|
||||||
|
@ -2054,7 +2052,6 @@ func toAPIErrorCode(ctx context.Context, err error) (apiErr APIErrorCode) {
|
||||||
apiErr = ErrKMSKeyNotFoundException
|
apiErr = ErrKMSKeyNotFoundException
|
||||||
case errKMSDefaultKeyAlreadyConfigured:
|
case errKMSDefaultKeyAlreadyConfigured:
|
||||||
apiErr = ErrKMSDefaultKeyAlreadyConfigured
|
apiErr = ErrKMSDefaultKeyAlreadyConfigured
|
||||||
|
|
||||||
case context.Canceled, context.DeadlineExceeded:
|
case context.Canceled, context.DeadlineExceeded:
|
||||||
apiErr = ErrOperationTimedOut
|
apiErr = ErrOperationTimedOut
|
||||||
case errDiskNotFound:
|
case errDiskNotFound:
|
||||||
|
@ -2069,6 +2066,11 @@ func toAPIErrorCode(ctx context.Context, err error) (apiErr APIErrorCode) {
|
||||||
apiErr = ErrObjectLockInvalidHeaders
|
apiErr = ErrObjectLockInvalidHeaders
|
||||||
case objectlock.ErrMalformedXML:
|
case objectlock.ErrMalformedXML:
|
||||||
apiErr = ErrMalformedXML
|
apiErr = ErrMalformedXML
|
||||||
|
default:
|
||||||
|
switch {
|
||||||
|
case errors.Is(err, errNoSuchPolicy):
|
||||||
|
apiErr = ErrAdminNoSuchPolicy
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compression errors
|
// Compression errors
|
||||||
|
|
Loading…
Reference in New Issue