From f41af8241ec77f385962e93eaa696a1e0b4581da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20M=C3=B3ricz?= Date: Fri, 23 May 2025 13:59:53 +0200 Subject: [PATCH] fix(scrapeURL/pdf): better timeout error --- apps/api/src/scraper/scrapeURL/engines/pdf/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/api/src/scraper/scrapeURL/engines/pdf/index.ts b/apps/api/src/scraper/scrapeURL/engines/pdf/index.ts index 30886d2f..61085592 100644 --- a/apps/api/src/scraper/scrapeURL/engines/pdf/index.ts +++ b/apps/api/src/scraper/scrapeURL/engines/pdf/index.ts @@ -233,8 +233,13 @@ export async function scrapePDF( base64Content, ); } catch (error) { - if (error instanceof RemoveFeatureError) { + if ( + error instanceof RemoveFeatureError + || error instanceof TimeoutError + ) { throw error; + } else if (error instanceof Error && error.name === "TimeoutError") { + throw new TimeoutError("PDF parsing timed out, please increase the timeout parameter in your scrape request"); } meta.logger.warn( "RunPod MU failed to parse PDF (could be due to timeout) -- falling back to parse-pdf",