fix(search): handle scrape timeouts on search

Fixes FIRECRAWL-SCRAPER-JS-15
This commit is contained in:
Gergő Móricz 2024-08-22 13:10:58 +02:00
parent 14fa75cae6
commit 508568f943

View File

@ -186,6 +186,10 @@ export async function searchController(req: Request, res: Response) {
}); });
return res.status(result.returnCode).json(result); return res.status(result.returnCode).json(result);
} catch (error) { } catch (error) {
if (error instanceof Error && error.message.startsWith("Job wait")) {
return res.status(408).json({ error: "Request timed out" });
}
Sentry.captureException(error); Sentry.captureException(error);
Logger.error(error); Logger.error(error);
return res.status(500).json({ error: error.message }); return res.status(500).json({ error: error.message });