From ce18bfb5ea0e7147a9b72e187aa7f4aeb0389acb Mon Sep 17 00:00:00 2001 From: Lachlan Kermode Date: Mon, 17 Dec 2018 11:51:06 +0000 Subject: [PATCH] temp fix to render domain error visible --- src/actions/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/actions/index.js b/src/actions/index.js index 1264aa2..24d2a6d 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -97,7 +97,6 @@ export function fetchDomain () { sourcesPromise ]) .then(response => { - dispatch(toggleFetchingDomain()) const result = { events: response[0], categories: response[1], @@ -107,11 +106,16 @@ export function fetchDomain () { sources: response[5], notifications } + if (Object.values(result).some(resp => resp.hasOwnProperty('error'))) { + throw new Error('Some URLs returned negative. If you are in development, check the server is running') + } return result }) .catch(err => { dispatch(fetchError(err.message)) dispatch(toggleFetchingDomain()) + // TODO: handle this appropriately in React hierarchy + alert(err.message) }) }; }