From 5a97b8f7c2ed8ff5636b3f90cfcbb5fe1748f172 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Sat, 5 Apr 2025 16:25:56 -0500 Subject: [PATCH] Improve static generation error logging --- src/app/static.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/app/static.ts b/src/app/static.ts index 0235691b..a13de9d5 100644 --- a/src/app/static.ts +++ b/src/app/static.ts @@ -25,7 +25,11 @@ export const staticallyGeneratePhotosIfConfigured = (type: StaticOutput) => ? async () => { const photos = await getPublicPhotoIds({ limit: GENERATE_STATIC_PARAMS_LIMIT, - }); + }) + .catch(e => { + console.error(`Error fetching static photo data: ${e}`); + return []; + }); if (IS_BUILDING) { logStaticGenerationDetails(photos.length, `photo ${type}`); } @@ -45,7 +49,12 @@ export const staticallyGenerateCategoryIfConfigured = ( (type === 'image' && STATICALLY_OPTIMIZED_PHOTO_CATEGORY_OG_IMAGES) ) ? async () => { - const data = (await getData()).slice(0, GENERATE_STATIC_PARAMS_LIMIT); + const data = (await getData() + .catch(e => { + console.error(`Error fetching static ${key} data: ${e}`); + return []; + })) + .slice(0, GENERATE_STATIC_PARAMS_LIMIT); if (IS_BUILDING) { logStaticGenerationDetails( data.length,