MCPcopy Create free account
hub / github.com/AbelChe/evil_minio / ToAPIErrWithErr

Method ToAPIErrWithErr

cmd/api-errors.go:426–441  ·  view source on GitHub ↗
(errCode APIErrorCode, err error)

Source from the content-addressed store, hash-verified

424type errorCodeMap map[APIErrorCode]APIError
425
426func (e errorCodeMap) ToAPIErrWithErr(errCode APIErrorCode, err error) APIError {
427 apiErr, ok := e[errCode]
428 if !ok {
429 apiErr = e[ErrInternalError]
430 }
431 if err != nil {
432 apiErr.Description = fmt.Sprintf("%s (%s)", apiErr.Description, err)
433 }
434 if globalSite.Region != "" {
435 if errCode == ErrAuthorizationHeaderMalformed {
436 apiErr.Description = fmt.Sprintf("The authorization header is malformed; the region is wrong; expecting '%s'.", globalSite.Region)
437 return apiErr
438 }
439 }
440 return apiErr
441}
442
443func (e errorCodeMap) ToAPIErr(errCode APIErrorCode) APIError {
444 return e.ToAPIErrWithErr(errCode, nil)

Callers 15

ToAPIErrMethod · 0.95
AddTierHandlerMethod · 0.80
EditTierHandlerMethod · 0.80
CancelBatchJobMethod · 0.80
AddServiceAccountMethod · 0.80
UpdateServiceAccountMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected