()
| 196 | } |
| 197 | |
| 198 | func (r *response) checkErrors() error { |
| 199 | if len(r.Errors) == 0 { |
| 200 | return nil |
| 201 | } |
| 202 | if len(r.Errors) == 1 { |
| 203 | return r.Errors[0] |
| 204 | } |
| 205 | var messagesBuilder strings.Builder |
| 206 | for _, e := range r.Errors { |
| 207 | messagesBuilder.WriteString(fmt.Sprintf("%s; ", e)) |
| 208 | } |
| 209 | return fmt.Errorf("API errors: %s", messagesBuilder.String()) |
| 210 | } |
| 211 | |
| 212 | type apiError struct { |
| 213 | Code json.Number `json:"code,omitempty"` |
no test coverage detected