From 6f548261a15c66612bada2262e8df5a564dda6ed Mon Sep 17 00:00:00 2001 From: Eric Allam Date: Tue, 3 May 2022 16:39:40 +0100 Subject: [PATCH] Adding additional logging to the $id endpoint --- app/routes/j/$id.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/routes/j/$id.tsx b/app/routes/j/$id.tsx index 2d02bb1..fcb4d1e 100644 --- a/app/routes/j/$id.tsx +++ b/app/routes/j/$id.tsx @@ -48,6 +48,10 @@ export const loader: LoaderFunction = async ({ params, request }) => { const jsonResponse = await safeFetch(doc.url); if (!jsonResponse.ok) { + console.log( + `Failed to fetch ${doc.url}: ${jsonResponse.status} (${jsonResponse.statusText})` + ); + throw new Response(jsonResponse.statusText, { status: jsonResponse.status, }); @@ -55,6 +59,8 @@ export const loader: LoaderFunction = async ({ params, request }) => { const json = await jsonResponse.json(); + console.log(`Fetched ${doc.url} with json, returning...`); + return { doc, json,