Skip to content

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

Nick: fixed error handling for v0 scrape

Nicolas3fc5ce17d273
diff --git a/apps/api/src/controllers/v0/scrape.ts b/apps/api/src/controllers/v0/scrape.ts
index c46ebc622..de6cf0327 100644
--- a/apps/api/src/controllers/v0/scrape.ts
+++ b/apps/api/src/controllers/v0/scrape.ts
@@ -285,11 +285,19 @@ export async function scrapeController(req: Request, res: Response) {
} catch (error) {
Sentry.captureException(error);
Logger.error(error);
- return res.status(500).json({
- error:
+ if (typeof error === "string" && error.startsWith("{\"type\":\"all\",")) {
+ return res.status(500).json({
+ success: false,
+ error: "All scraping methods failed for URL: " + req.body.url,
+ details: JSON.parse(error).errors as string[],
+ });
+ } else {
+ return res.status(500).json({
+ error:
typeof error === "string"
? error
: error?.message ?? "Internal Server Error",
- });
+ });
+ }
}
}