From 5a039e7b64c04e00d7ab73f9758b518866dec929 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20M=C3=B3ricz?= Date: Wed, 22 Jan 2025 19:00:46 +0100 Subject: [PATCH] fix(v1/map): add wrapper around tryGetSitemap --- apps/api/src/controllers/v1/map.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/api/src/controllers/v1/map.ts b/apps/api/src/controllers/v1/map.ts index a50357d1..3d6c5541 100644 --- a/apps/api/src/controllers/v1/map.ts +++ b/apps/api/src/controllers/v1/map.ts @@ -171,9 +171,13 @@ export async function getMapResults({ (sitemapIndexResult.urls.length < 100 || new Date(sitemapIndexResult.lastUpdated) < twoDaysAgo) ) { - await crawler.tryGetSitemap(urls => { - links.push(...urls); - }, true, false, 30000); + try { + await crawler.tryGetSitemap(urls => { + links.push(...urls); + }, true, false, 30000); + } catch (e) { + logger.warn("tryGetSitemap threw an error", { error: e }); + } } if (!cachedResult) {