firecrawl 1.4.2 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -271,8 +271,16 @@ var FirecrawlApp = class {
271
271
  * @param headers - The headers for the request.
272
272
  * @returns The response from the GET request.
273
273
  */
274
- getRequest(url, headers) {
275
- return import_axios.default.get(url, { headers });
274
+ async getRequest(url, headers) {
275
+ try {
276
+ return await import_axios.default.get(url, { headers });
277
+ } catch (error) {
278
+ if (error instanceof import_axios.AxiosError && error.response) {
279
+ return error.response;
280
+ } else {
281
+ throw error;
282
+ }
283
+ }
276
284
  }
277
285
  /**
278
286
  * Monitors the status of a crawl job until completion or failure.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/index.ts
2
- import axios from "axios";
2
+ import axios, { AxiosError } from "axios";
3
3
  import { zodToJsonSchema } from "zod-to-json-schema";
4
4
  import { WebSocket } from "isows";
5
5
  import { TypedEventTarget } from "typescript-event-target";
@@ -236,8 +236,16 @@ var FirecrawlApp = class {
236
236
  * @param headers - The headers for the request.
237
237
  * @returns The response from the GET request.
238
238
  */
239
- getRequest(url, headers) {
240
- return axios.get(url, { headers });
239
+ async getRequest(url, headers) {
240
+ try {
241
+ return await axios.get(url, { headers });
242
+ } catch (error) {
243
+ if (error instanceof AxiosError && error.response) {
244
+ return error.response;
245
+ } else {
246
+ throw error;
247
+ }
248
+ }
241
249
  }
242
250
  /**
243
251
  * Monitors the status of a crawl job until completion or failure.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "firecrawl",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "JavaScript SDK for Firecrawl API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import axios, { type AxiosResponse, type AxiosRequestHeaders } from "axios";
1
+ import axios, { type AxiosResponse, type AxiosRequestHeaders, AxiosError } from "axios";
2
2
  import type * as zt from "zod";
3
3
  import { zodToJsonSchema } from "zod-to-json-schema";
4
4
  import { WebSocket } from "isows";
@@ -452,11 +452,19 @@ export default class FirecrawlApp {
452
452
  * @param headers - The headers for the request.
453
453
  * @returns The response from the GET request.
454
454
  */
455
- getRequest(
455
+ async getRequest(
456
456
  url: string,
457
457
  headers: AxiosRequestHeaders
458
458
  ): Promise<AxiosResponse> {
459
- return axios.get(url, { headers });
459
+ try {
460
+ return await axios.get(url, { headers });
461
+ } catch (error) {
462
+ if (error instanceof AxiosError && error.response) {
463
+ return error.response as AxiosResponse;
464
+ } else {
465
+ throw error;
466
+ }
467
+ }
460
468
  }
461
469
 
462
470
  /**