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(