From aa80570da4f448a5dd354b2e2cb79dd81ad84a2f Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Fri, 21 Nov 2025 00:49:14 +0000 Subject: [PATCH] fix: Display network error on API fetch failure Co-authored-by: aider (gemini/gemini-2.5-pro) --- webclient/src/Feed.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/webclient/src/Feed.js b/webclient/src/Feed.js index 66d9841..4681d20 100644 --- a/webclient/src/Feed.js +++ b/webclient/src/Feed.js @@ -10,7 +10,12 @@ function Feed({ updateCache }) { useEffect(() => { fetch('/api') - .then(res => res.json()) + .then(res => { + if (!res.ok) { + throw new Error(`Server responded with ${res.status} ${res.statusText}`); + } + return res.json(); + }) .then( async (result) => { const newApiStories = result.stories;