Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

added 403s to sdk error handlers (#1357)

Rafael Miller6d3c639f585a
diff --git a/apps/js-sdk/firecrawl/src/index.ts b/apps/js-sdk/firecrawl/src/index.ts
index 54bb6f4f8..bd63d494a 100644
--- a/apps/js-sdk/firecrawl/src/index.ts
+++ b/apps/js-sdk/firecrawl/src/index.ts
@@ -1388,7 +1388,7 @@ export default class FirecrawlApp {
* @param {string} action - The action being performed when the error occurred.
*/
handleError(response: AxiosResponse, action: string): void {
- if ([400, 402, 408, 409, 500].includes(response.status)) {
+ if ([400, 402, 403, 408, 409, 500].includes(response.status)) {
const errorMessage: string =
response.data.error || "Unknown error occurred";
const details = response.data.details ? ` - ${JSON.stringify(response.data.details)}` : '';
diff --git a/apps/python-sdk/firecrawl/firecrawl.py b/apps/python-sdk/firecrawl/firecrawl.py
index f4ddb91ed..a221e74c4 100644
--- a/apps/python-sdk/firecrawl/firecrawl.py
+++ b/apps/python-sdk/firecrawl/firecrawl.py
@@ -1098,6 +1098,8 @@ class FirecrawlApp:
if response.status_code == 402:
message = f"Payment Required: Failed to {action}. {error_message} - {error_details}"
+ elif response.status_code == 403:
+ message = f"Website Not Supported: Failed to {action}. {error_message} - {error_details}"
elif response.status_code == 408:
message = f"Request Timeout: Failed to {action} as the request timed out. {error_message} - {error_details}"
elif response.status_code == 409: