mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-20 18:59:08 +08:00
Fix sdk/undefined response handle error (#1578)
* fix(sdk): update version to 1.25.1 and enhance error handling in FirecrawlApp (#1576) * package version bump
This commit is contained in:
parent
a5a915d639
commit
6d75161302
@ -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",
|
||||
|
@ -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";
|
||||
|
Loading…
x
Reference in New Issue
Block a user