Nick: patch js-sdk

This commit is contained in:
Nicolas 2025-01-18 18:08:50 -03:00
parent 56776da28d
commit a7178c0c6f
2 changed files with 6 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@mendable/firecrawl-js",
"version": "1.15.2",
"version": "1.15.3",
"description": "JavaScript SDK for Firecrawl API",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View File

@ -1255,12 +1255,14 @@ export default class FirecrawlApp {
* @param {string} action - The action being performed when the error occurred.
*/
handleError(response: AxiosResponse, action: string): void {
if ([402, 408, 409, 500].includes(response.status)) {
if ([400, 402, 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)}` : '';
throw new FirecrawlError(
`Failed to ${action}. Status code: ${response.status}. Error: ${errorMessage}`,
response.status
`Failed to ${action}. Status code: ${response.status}. Error: ${errorMessage}${details}`,
response.status,
response.data.details
);
} else {
throw new FirecrawlError(