added 403s to sdk error handlers (#1357)

This commit is contained in:
Rafael Miller 2025-03-17 14:06:29 -03:00 committed by GitHub
parent d12feaea52
commit 6d3c639f58
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View File

@ -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)}` : '';

View File

@ -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: