bit of readability and catching error (but just silencing for now)

pull/132/head
Beaudan 6 years ago
parent bdbdf15469
commit badaf40ca8

@ -690,7 +690,8 @@ async function saveConversations(data) {
} }
async function getConversationById(id, { Conversation }) { async function getConversationById(id, { Conversation }) {
const data = setifyProperty(await channels.getConversationById(id), 'swarmNodes'); const rawData = await channels.getConversationById(id)
const data = setifyProperty(rawData, 'swarmNodes');
return new Conversation(data); return new Conversation(data);
} }

@ -92,7 +92,13 @@ class LokiSnodeAPI {
const conversation = window.ConversationController.get(pubKey); const conversation = window.ConversationController.get(pubKey);
if (!(pubKey in this.swarmsPendingReplenish)) { if (!(pubKey in this.swarmsPendingReplenish)) {
this.swarmsPendingReplenish[pubKey] = new Promise(async (resolve) => { this.swarmsPendingReplenish[pubKey] = new Promise(async (resolve) => {
const newSwarmNodes = new Set(await this.getSwarmNodes(pubKey)); let newSwarmNodes
try {
newSwarmNodes = new Set(await this.getSwarmNodes(pubKey));
} catch (e) {
// TODO: Handle these errors sensibly
newSwarmNodes = new Set([]);
}
conversation.set({ swarmNodes: newSwarmNodes }); conversation.set({ swarmNodes: newSwarmNodes });
await window.Signal.Data.updateConversation(conversation.id, conversation.attributes, { await window.Signal.Data.updateConversation(conversation.id, conversation.attributes, {
Conversation: Whisper.Conversation, Conversation: Whisper.Conversation,

Loading…
Cancel
Save