Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

fix(scrapeURL/pdf): better timeout error

Gergő Móriczf41af8241ec7
diff --git a/apps/api/src/scraper/scrapeURL/engines/pdf/index.ts b/apps/api/src/scraper/scrapeURL/engines/pdf/index.ts
index 30886d2f4..610855920 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",