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",
|
||||
"version": "1.15.2",
|
||||
"version": "1.15.3",
|
||||
"description": "JavaScript SDK for Firecrawl API",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user