From d9720829424f01bedfd2edc5cb6682c820566a2b Mon Sep 17 00:00:00 2001 From: Determinant Date: Tue, 29 Jan 2019 20:27:25 -0500 Subject: catch genEventsGetter errors --- src/App.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/App.js b/src/App.js index 6676c38..cbaeae5 100755 --- a/src/App.js +++ b/src/App.js @@ -74,7 +74,12 @@ function genEventsGetter(calId, timeMin, timeMax) { timeMin, timeMax }), { method: 'GET', async: true }) - .then(response => response.json()) + .then(response => { + if (response.status == 200) + return response.json() + else throw `got response ${response.status}`; + }) + .catch(e => { console.log(e); return []; }) .then(data => data.items); } -- cgit v1.2.3-70-g09d2