Skip to content

Allow search archive results with error fields#24

Draft
nya-a-cat wants to merge 1 commit into
serpapi:masterfrom
nya-a-cat:fix/search-archive-error-fields
Draft

Allow search archive results with error fields#24
nya-a-cat wants to merge 1 commit into
serpapi:masterfrom
nya-a-cat:fix/search-archive-error-fields

Conversation

@nya-a-cat

Copy link
Copy Markdown

Fixes #17.

Search archive responses can return HTTP 200 with a top-level error field when the archived search itself failed. The client currently raises SerpApiError for those responses, which prevents callers from inspecting failed archived searches.

This change keeps the behavior scoped to search_archive: archived 200 + error JSON responses are returned, while regular search responses and non-200 archive responses still raise.

I noticed #22 also touched this behavior, but that PR was closed unmerged and included several unrelated changes. This PR keeps the fix scoped to #17 only.

Tested:

  • rspec spec/serpapi/client/search_archive_error_handling_spec.rb --format documentation
  • ruby -c lib/serpapi/client.rb
  • ruby -c spec/serpapi/client/search_archive_error_handling_spec.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Do not raise error for search archive results

1 participant