MCPcopy Create free account
hub / github.com/SaadBelfqih/apple-ads-cli / Error

Method Error

internal/api/errors.go:19–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17}
18
19func (e *APIError) Error() string {
20 retryInfo := ""
21 if e.RetryAfter > 0 {
22 retryInfo = fmt.Sprintf(" (retry after %s)", e.RetryAfter)
23 }
24
25 if len(e.Errors) == 0 {
26 return fmt.Sprintf("API error %d%s: %s", e.StatusCode, retryInfo, e.RawBody)
27 }
28
29 var msgs []string
30 for _, err := range e.Errors {
31 msg := err.Message
32 if err.Field != "" {
33 msg = fmt.Sprintf("%s (field: %s)", msg, err.Field)
34 }
35 msgs = append(msgs, msg)
36 }
37 return fmt.Sprintf("API error %d%s: %s", e.StatusCode, retryInfo, strings.Join(msgs, "; "))
38}

Callers 1

update.goFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected