Nick: fixed error handling for v0 scrape
This commit is contained in:
parent
0690cfeaad
commit
3fc5ce17d2
|
@ -285,11 +285,19 @@ export async function scrapeController(req: Request, res: Response) {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Sentry.captureException(error);
|
Sentry.captureException(error);
|
||||||
Logger.error(error);
|
Logger.error(error);
|
||||||
return res.status(500).json({
|
if (typeof error === "string" && error.startsWith("{\"type\":\"all\",")) {
|
||||||
error:
|
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"
|
typeof error === "string"
|
||||||
? error
|
? error
|
||||||
: error?.message ?? "Internal Server Error",
|
: error?.message ?? "Internal Server Error",
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue