| @@ -7,8 +7,9 @@ | ||
| 7 | 7 | setStatus, |
| 8 | 8 | } from '@auto-launch/functions/helpers'; |
| 9 | 9 | import { launchStrings } from '@auto-launch/strings'; |
| 10 | 10 | import { IMAGES_HOST } from '@constants'; |
| 11 | +import { digest } from '@shared/api/digest'; | |
| 11 | 12 | import { reqDataBasics } from '@shared/lib/data'; |
| 12 | 13 | |
| 13 | 14 | const fallback = { siteImages: { hero: [], general: [] } }; |
| 14 | 15 | const url = `${IMAGES_HOST}/api/images`; |
| @@ -40,11 +41,23 @@ | ||
| 40 | 41 | }); |
| 41 | 42 | |
| 42 | 43 | const response = await retryTwice(() => |
| 43 | 44 | fetchWithTimeout(url, { method, headers, body }), |
| 44 | - ); | |
| 45 | + ).catch((error) => { | |
| 46 | + return { ok: false, statusText: error.message, status: 0 }; | |
| 47 | + }); | |
| 45 | 48 | |
| 46 | - if (!response?.ok) return { siteImages: asSections(seeded) }; | |
| 49 | + if (!response?.ok) { | |
| 50 | + digest({ | |
| 51 | + error: { | |
| 52 | + message: response.statusText, | |
| 53 | + name: 'FetchError', | |
| 54 | + status: response.status, | |
| 55 | + }, | |
| 56 | + details: { source: 'auto-launch', caller: 'handleSiteImages' }, | |
| 57 | + }); | |
| 58 | + return { siteImages: asSections(seeded) }; | |
| 59 | + } | |
| 47 | 60 | |
| 48 | 61 | const { siteImages: found } = await failWithFallback( |
| 49 | 62 | async () => { |
| 50 | 63 | const { images } = await response.json(); |