(errCode APIErrorCode, err error)
| 424 | type errorCodeMap map[APIErrorCode]APIError |
| 425 | |
| 426 | func (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 | |
| 443 | func (e errorCodeMap) ToAPIErr(errCode APIErrorCode) APIError { |
| 444 | return e.ToAPIErrWithErr(errCode, nil) |
no outgoing calls
no test coverage detected