cleanup ignored static analysis (#16767)

This commit is contained in:
ferhat elmas
2023-03-06 17:56:10 +01:00
committed by GitHub
parent 3423028713
commit 714283fae2
48 changed files with 182 additions and 261 deletions

View File

@@ -424,8 +424,7 @@ func (e errorCodeMap) ToAPIErrWithErr(errCode APIErrorCode, err error) APIError
apiErr.Description = fmt.Sprintf("%s (%s)", apiErr.Description, err)
}
if globalSite.Region != "" {
switch errCode {
case ErrAuthorizationHeaderMalformed:
if errCode == ErrAuthorizationHeaderMalformed {
apiErr.Description = fmt.Sprintf("The authorization header is malformed; the region is wrong; expecting '%s'.", globalSite.Region)
return apiErr
}
@@ -2067,15 +2066,13 @@ func toAPIErrorCode(ctx context.Context, err error) (apiErr APIErrorCode) {
case objectlock.ErrMalformedXML:
apiErr = ErrMalformedXML
default:
switch {
case errors.Is(err, errNoSuchPolicy):
if errors.Is(err, errNoSuchPolicy) {
apiErr = ErrAdminNoSuchPolicy
}
}
// Compression errors
switch err {
case errInvalidDecompressedSize:
if err == errInvalidDecompressedSize {
apiErr = ErrInvalidDecompressedSize
}
@@ -2281,8 +2278,7 @@ func toAPIError(ctx context.Context, err error) APIError {
}
if apiErr.Code == "NotImplemented" {
switch e := err.(type) {
case NotImplemented:
if e, ok := err.(NotImplemented); ok {
desc := e.Error()
if desc == "" {
desc = apiErr.Description