From 287847fcfb201f18b4bd416d035f35193a91c599 Mon Sep 17 00:00:00 2001 From: Guillaume Dorce Date: Fri, 11 Oct 2024 11:51:13 +0200 Subject: [PATCH] catch error when getting status --- index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 0caf710..f9f5c28 100644 --- a/index.js +++ b/index.js @@ -71,8 +71,12 @@ init(); async function getAllUsersStatus() { for (let i = 0; i < usernames.length; i++) { - const userData = await getUserStatus(usernames[i].name, usernames[i].id); - usernames[i] = { ...usernames[i], ...userData }; + try { + const userData = await getUserStatus(usernames[i].name, usernames[i].id); + usernames[i] = { ...usernames[i], ...userData }; + } catch (error) { + console.error(error); + } if (i === usernames.length - 1) { console.log("Successfully updated all users"); }