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;