From 63fe10735dc4c8e638dac7a55fcc7ebf2731a74e Mon Sep 17 00:00:00 2001 From: Gianni GIUDICE Date: Mon, 15 Feb 2021 18:18:52 +0100 Subject: [PATCH] =?UTF-8?q?:children=5Fcrossing:=20Ajout=20de=20la=20gesti?= =?UTF-8?q?on=20d'erreur=20sur=20chaque=20route=20appel=C3=A9e=20:=20on=20?= =?UTF-8?q?affichera=20null=20pour=20les=20propri=C3=A9t=C3=A9s=20dont=20l?= =?UTF-8?q?'appel=20API=20a=20=C3=A9chou=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.js b/index.js index cd0bbbc..af0adf6 100644 --- a/index.js +++ b/index.js @@ -30,6 +30,8 @@ const getCatFacts = (amount) => { facts.push(data[i].text); } resolve(facts); + }).catch(err => { + resolve(null); }) }); }; @@ -40,6 +42,8 @@ const getFoxImage = () => { axios.get('https://randomfox.ca/floof/').then(res => { const data = res.data; resolve(data.image); + }).catch(err => { + resolve(null); }) }); }; @@ -50,6 +54,8 @@ const getDayOff = (country) => { axios.get('https://date.nager.at/api/v2/PublicHolidays/2021/' + country).then(res => { const data = res.data; resolve(data); + }).catch(err => { + resolve(null); }) }); };