From 3f50d089ad5183da3cb10b441b7bd744241d1089 Mon Sep 17 00:00:00 2001 From: Angelika Serwa Date: Mon, 4 Nov 2024 21:44:29 +0100 Subject: [PATCH] [lib] Don't swallow errors in useGetAndUpdateDeviceListsForUsers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: https://linear.app/comm/issue/ENG-9730/native-crashes-when-call-to-identity-fails Depends on D13863 Test Plan: Force the error when sending message:
 1. Create DM with some user 2. Change identity address to some random address 3. Remove device lists by dispatching an action as described in the issue 4. Try to send a message 5. Verify that the app doesn't crash and user can retry sending the message and you can see the error nicely in the logs Reviewers: tomek, kamil Reviewed By: kamil Subscribers: ashoat Differential Revision: https://phab.comm.dev/D13864 --- lib/hooks/peer-list-hooks.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/hooks/peer-list-hooks.js b/lib/hooks/peer-list-hooks.js index 7ec7485509..6d5a7acb7b 100644 --- a/lib/hooks/peer-list-hooks.js +++ b/lib/hooks/peer-list-hooks.js @@ -74,16 +74,10 @@ function useGetAndUpdateDeviceListsForUsers(): ( return React.useCallback( async (userIDs: $ReadOnlyArray, broadcastUpdates: ?boolean) => { - let result; - try { - result = await Promise.race([ - getDeviceListsForUsers(userIDs), - throwOnTimeout(userIDs), - ]); - } catch (e) { - console.log(e); - } - + const result = await Promise.race([ + getDeviceListsForUsers(userIDs), + throwOnTimeout(userIDs), + ]); if (!result) { return null; }