From a7178c0c6f1ff791be6ef360b0a48a4d420b9856 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Sat, 18 Jan 2025 18:08:50 -0300 Subject: [PATCH] Nick: patch js-sdk --- apps/js-sdk/firecrawl/package.json | 2 +- apps/js-sdk/firecrawl/src/index.ts | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/js-sdk/firecrawl/package.json b/apps/js-sdk/firecrawl/package.json index 1d25738d..31fccfad 100644 --- a/apps/js-sdk/firecrawl/package.json +++ b/apps/js-sdk/firecrawl/package.json @@ -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", diff --git a/apps/js-sdk/firecrawl/src/index.ts b/apps/js-sdk/firecrawl/src/index.ts index 02ea41da..aab316fd 100644 --- a/apps/js-sdk/firecrawl/src/index.ts +++ b/apps/js-sdk/firecrawl/src/index.ts @@ -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(