Skip to content

search: show the API's error message for refused requests - #355

Draft
rakshith48 wants to merge 1 commit into
mainfrom
rak/search-api-error
Draft

rakshith48 wants to merge 1 commit into
mainfrom
rak/search-api-error

Conversation

@rakshith48

Copy link
Copy Markdown
Contributor

firecrawl search now prints the API's own error message when a request is refused. Before, it printed only Error: Request failed with status code 402.

Why search was different. Search posts through the SDK's raw HTTP client, so a refused request throws an HTTP client error whose message names only the status. The API's explanation, including its upgrade link, stays in error.response.data.error. The other commands go through SDK methods, which already turn that field into the error message, so search now does the same.

When the response has no error field, search falls back to the error's own message, as before.

Test: a 402 from /v2/search returns the API's error text.

Open in Capy

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

1 participant