fix: updated pollOnceForDisplayName

we can return the try result directly in the block since the finally will alway be executed
pull/3056/head
William Grant 2 years ago
parent 6c93639c4b
commit 5a131c5785

@ -406,8 +406,6 @@ export class SwarmPolling {
); );
if (returnDisplayNameOnly) { if (returnDisplayNameOnly) {
let displayName = '';
try { try {
const keypair = await UserUtils.getUserED25519KeyPairBytes(); const keypair = await UserUtils.getUserED25519KeyPairBytes();
if (!keypair || !keypair.privKeyBytes) { if (!keypair || !keypair.privKeyBytes) {
@ -429,7 +427,7 @@ export class SwarmPolling {
if (!userInfo) { if (!userInfo) {
throw new Error('UserInfo not found'); throw new Error('UserInfo not found');
} }
displayName = userInfo.name; return userInfo.name;
} catch (e) { } catch (e) {
window.log.warn( window.log.warn(
'LibSessionUtil.initializeLibSessionUtilWrappers failed with', 'LibSessionUtil.initializeLibSessionUtilWrappers failed with',
@ -439,7 +437,7 @@ export class SwarmPolling {
await GenericWrapperActions.free('UserConfig'); await GenericWrapperActions.free('UserConfig');
} }
return displayName; return '';
} }
await ConfigMessageHandler.handleConfigMessagesViaLibSession(allDecryptedConfigMessages); await ConfigMessageHandler.handleConfigMessagesViaLibSession(allDecryptedConfigMessages);

Loading…
Cancel
Save