Adding additional logging to the $id endpoint

This commit is contained in:
Eric Allam
2022-05-03 16:39:40 +01:00
parent 635a97b133
commit 6f548261a1
+6
View File
@@ -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,