From dd0f625e5f65e95634a45a18a3c3e6c3db55da71 Mon Sep 17 00:00:00 2001 From: Idan Novogroder Date: Mon, 16 Dec 2024 16:59:38 +0200 Subject: [PATCH] Error handling --- webui/src/pages/auth/groups/group/members.jsx | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/webui/src/pages/auth/groups/group/members.jsx b/webui/src/pages/auth/groups/group/members.jsx index b6d0af27ea5..66df2c76ca9 100644 --- a/webui/src/pages/auth/groups/group/members.jsx +++ b/webui/src/pages/auth/groups/group/members.jsx @@ -41,16 +41,20 @@ const GroupMemberList = ({ groupId, after, onPaginate }) => { after = "" let hasMore = true let usersList = [] - do { - let results = await auth.listUsers("", after, MAX_LISTING_AMOUNT); - usersList = usersList.concat(results.results); - after = results.pagination.next_offset; - hasMore = results.pagination.has_more; + try { + do { + const results = await auth.listUsers("", after, MAX_LISTING_AMOUNT); + usersList = usersList.concat(results.results); + after = results.pagination.next_offset; + hasMore = results.pagination.has_more; + } while (hasMore); + usersList.sort((a, b) => ResolveEntityDisplayName(a).localeCompare(ResolveEntityDisplayName(b))); + setAllUsers(usersList); + return usersList; + } catch (error) { + console.error("Error fetching users:", error); + return []; } - while (hasMore); - usersList.sort((a, b) => ResolveEntityDisplayName(a).localeCompare(ResolveEntityDisplayName(b))); - setAllUsers(usersList) - return usersList } const searchUsers = async (prefix, maxResults) => { let allUsersList = await setAllUsersFromLakeFS()