()
| 47 | } |
| 48 | |
| 49 | func (e *APIError) Error() string { |
| 50 | if e.Code == 0 { |
| 51 | if e.Detail == "" { |
| 52 | return "APIError <empty>" |
| 53 | } |
| 54 | return e.Detail |
| 55 | } |
| 56 | s := fmt.Sprintf("API error %d", e.Code) |
| 57 | if m, ok := errorCodeMaps[e.Service]; ok { |
| 58 | s += " (" + e.Service + ": " + m[e.Code] + ")" |
| 59 | } else { |
| 60 | // Shouldn't happen, but provide a bit more detail if it does. |
| 61 | s = e.Service + " " + s |
| 62 | } |
| 63 | if e.Detail != "" { |
| 64 | s += ": " + e.Detail |
| 65 | } |
| 66 | return s |
| 67 | } |
| 68 | |
| 69 | func (e *APIError) IsTimeout() bool { |
| 70 | return timeoutCodes[timeoutCodeKey{e.Service, e.Code}] |
no outgoing calls