Add try..catch in forms main.js

pull/1/head
yflory 3 years ago
parent 442afe14a4
commit b964af4da2

@ -268,16 +268,20 @@ define([
var messages = obj.messages; var messages = obj.messages;
if (!messages.length) { return void cb(); } if (!messages.length) { return void cb(); }
if (obj.lastKnownHash !== answer.hash) { return void cb(); } if (obj.lastKnownHash !== answer.hash) { return void cb(); }
var res = Utils.Crypto.Mailbox.openOwnSecretLetter(messages[0].msg, { try {
validateKey: data.validateKey, var res = Utils.Crypto.Mailbox.openOwnSecretLetter(messages[0].msg, {
ephemeral_private: Nacl.util.decodeBase64(answer.curvePrivate), validateKey: data.validateKey,
my_private: Nacl.util.decodeBase64(myKeys.curvePrivate), ephemeral_private: Nacl.util.decodeBase64(answer.curvePrivate),
their_public: Nacl.util.decodeBase64(data.publicKey) my_private: Nacl.util.decodeBase64(myKeys.curvePrivate),
}); their_public: Nacl.util.decodeBase64(data.publicKey)
var parsed = JSON.parse(res.content); });
parsed._isAnon = answer.anonymous; var parsed = JSON.parse(res.content);
parsed._time = messages[0].time; parsed._isAnon = answer.anonymous;
cb(parsed); parsed._time = messages[0].time;
cb(parsed);
} catch (e) {
cb({error: e});
}
}); });
}); });

Loading…
Cancel
Save