0

Nick: 408 handling

This commit is contained in:
Nicolas 2024-05-13 18:34:00 -07:00
parent 999176d576
commit aa0c8188c9

View File

@ -109,7 +109,7 @@ export default class FirecrawlApp {
const response: AxiosResponse = await axios.post( const response: AxiosResponse = await axios.post(
"https://api.firecrawl.dev/v0/scrape", "https://api.firecrawl.dev/v0/scrape",
jsonData, jsonData,
{ headers } { headers },
); );
if (response.status === 200) { if (response.status === 200) {
const responseData = response.data; const responseData = response.data;
@ -324,7 +324,7 @@ 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, 409, 500].includes(response.status)) { if ([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";
throw new Error( throw new Error(