Skip to content

Commit

Permalink
backend error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
artlu99 committed Jun 25, 2024
1 parent 586ed85 commit 0bbd0fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion functions/getForYouFeed/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ export const onRequestPost: PagesFunction<Env> = async (context) => {
},
});

if (!res.ok) throw new Error('Failed to fetch data');
if (!res.ok) {
console.error(endpoint, res.status, JSON.stringify(res));
throw new Error('Failed to fetch data');
}

const forYouFeedResponse = (await res.json()) as FeedObject;
return new Response(JSON.stringify(forYouFeedResponse));
Expand Down
2 changes: 1 addition & 1 deletion functions/getReactionsByHash/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ export const onRequestPost: PagesFunction<Env> = async (context) => {
});
if (!res.ok) throw new Error('Failed to fetch data');

const reactionsResponse: ReactionsByHashResponseSchema = await res.json();
const reactionsResponse = (await res.json()) as ReactionsByHashResponseSchema;
return new Response(JSON.stringify(reactionsResponse));
};

0 comments on commit 0bbd0fd

Please sign in to comment.