()
| 288 | } |
| 289 | |
| 290 | func (err httpError) Error() string { |
| 291 | if err.StatusCode != 422 || len(err.Errors) == 0 { |
| 292 | return fmt.Sprintf("HTTP %d: %s (%s)", err.StatusCode, err.Message, err.RequestURL) |
| 293 | } |
| 294 | query := strings.TrimSpace(err.RequestURL.Query().Get("q")) |
| 295 | return fmt.Sprintf("Invalid search query %q.\n%s", query, err.Errors[0].Message) |
| 296 | } |
| 297 | |
| 298 | func handleHTTPError(resp *http.Response) error { |
| 299 | httpError := httpError{ |