catch error when getting status

This commit is contained in:
Guillaume Dorce 2024-10-11 11:51:13 +02:00
parent f457a86bde
commit 287847fcfb
1 changed files with 6 additions and 2 deletions

View File

@ -71,8 +71,12 @@ init();
async function getAllUsersStatus() { async function getAllUsersStatus() {
for (let i = 0; i < usernames.length; i++) { for (let i = 0; i < usernames.length; i++) {
const userData = await getUserStatus(usernames[i].name, usernames[i].id); try {
usernames[i] = { ...usernames[i], ...userData }; 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) { if (i === usernames.length - 1) {
console.log("Successfully updated all users"); console.log("Successfully updated all users");
} }