mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-12 21:09:03 +08:00
Nick: patch js-sdk
This commit is contained in:
parent
56776da28d
commit
a7178c0c6f
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@mendable/firecrawl-js",
|
"name": "@mendable/firecrawl-js",
|
||||||
"version": "1.15.2",
|
"version": "1.15.3",
|
||||||
"description": "JavaScript SDK for Firecrawl API",
|
"description": "JavaScript SDK for Firecrawl API",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
|
@ -1255,12 +1255,14 @@ export default class FirecrawlApp {
|
|||||||
* @param {string} action - The action being performed when the error occurred.
|
* @param {string} action - The action being performed when the error occurred.
|
||||||
*/
|
*/
|
||||||
handleError(response: AxiosResponse, action: string): void {
|
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 =
|
const errorMessage: string =
|
||||||
response.data.error || "Unknown error occurred";
|
response.data.error || "Unknown error occurred";
|
||||||
|
const details = response.data.details ? ` - ${JSON.stringify(response.data.details)}` : '';
|
||||||
throw new FirecrawlError(
|
throw new FirecrawlError(
|
||||||
`Failed to ${action}. Status code: ${response.status}. Error: ${errorMessage}`,
|
`Failed to ${action}. Status code: ${response.status}. Error: ${errorMessage}${details}`,
|
||||||
response.status
|
response.status,
|
||||||
|
response.data.details
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
throw new FirecrawlError(
|
throw new FirecrawlError(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user