mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-11 17:48:59 +08:00
added 403s to sdk error handlers (#1357)
This commit is contained in:
parent
d12feaea52
commit
6d3c639f58
@ -1388,7 +1388,7 @@ export default class FirecrawlApp {
|
|||||||
* @param {string} action - The action being performed when the error occurred.
|
* @param {string} action - The action being performed when the error occurred.
|
||||||
*/
|
*/
|
||||||
handleError(response: AxiosResponse, action: string): void {
|
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 =
|
const errorMessage: string =
|
||||||
response.data.error || "Unknown error occurred";
|
response.data.error || "Unknown error occurred";
|
||||||
const details = response.data.details ? ` - ${JSON.stringify(response.data.details)}` : '';
|
const details = response.data.details ? ` - ${JSON.stringify(response.data.details)}` : '';
|
||||||
|
@ -1098,6 +1098,8 @@ class FirecrawlApp:
|
|||||||
|
|
||||||
if response.status_code == 402:
|
if response.status_code == 402:
|
||||||
message = f"Payment Required: Failed to {action}. {error_message} - {error_details}"
|
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:
|
elif response.status_code == 408:
|
||||||
message = f"Request Timeout: Failed to {action} as the request timed out. {error_message} - {error_details}"
|
message = f"Request Timeout: Failed to {action} as the request timed out. {error_message} - {error_details}"
|
||||||
elif response.status_code == 409:
|
elif response.status_code == 409:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user