Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
Fix sdk/undefined response handle error (#1578)
Rafael Miller6d751613024b
diff --git a/apps/js-sdk/firecrawl/package.json b/apps/js-sdk/firecrawl/package.jsonindex 4583b6bfa..0baa2d5b7 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.25.0",+ "version": "1.25.1","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.tsindex 7639160e9..ca77d2004 100644--- a/apps/js-sdk/firecrawl/src/index.ts+++ b/apps/js-sdk/firecrawl/src/index.ts@@ -560,7 +560,7 @@ export interface GenerateLLMsTextStatusResponse {export default class FirecrawlApp {public apiKey: string;public apiUrl: string;- public version: string = "1.19.1";+ public version: string = "1.25.1";private isCloudService(url: string): boolean {return url.includes('api.firecrawl.dev');@@ -572,7 +572,7 @@ export default class FirecrawlApp {return packageJson.default.version;} catch (error) {console.error("Error getting version:", error);- return "1.19.1";+ return "1.25.1";}}@@ -1491,6 +1491,13 @@ export default class FirecrawlApp {* @param {string} action - The action being performed when the error occurred.*/handleError(response: AxiosResponse, action: string): void {+ if (!response) {+ throw new FirecrawlError(+ `No response received while trying to ${action}. This may be a network error or the server is unreachable.`,+ 0+ );+ }+if ([400, 402, 403, 408, 409, 500].includes(response.status)) {const errorMessage: string =response.data.error || "Unknown error occurred";