diff --git a/js/background.js b/js/background.js index 3352f005..6735b19d 100644 --- a/js/background.js +++ b/js/background.js @@ -125,27 +125,26 @@ return; } - if (!ev.proto) { - console.log(e); - throw e; + if (ev.proto) { + var envelope = ev.proto; + var message = initIncomingMessage(envelope.source, envelope.timestamp.toNumber()); + if (e.name === 'IncomingIdentityKeyError') { + message.save({ errors : [e] }).then(function() { + extension.trigger('updateInbox'); + notifyConversation(message); + }); + return; + } else if (e.message !== 'Bad MAC') { + message.save({ errors : [ _.pick(e, ['name', 'message'])]}).then(function() { + extension.trigger('updateInbox'); + notifyConversation(message); + }); + return; + } } - var envelope = ev.proto; - var message = initIncomingMessage(envelope.source, envelope.timestamp.toNumber()); - if (e.name === 'IncomingIdentityKeyError') { - message.save({ errors : [e] }).then(function() { - extension.trigger('updateInbox'); - notifyConversation(message); - }); - } else if (e.message !== 'Bad MAC') { - message.save({ errors : [ _.pick(e, ['name', 'message'])]}).then(function() { - extension.trigger('updateInbox'); - notifyConversation(message); - }); - } else { - console.log(e); - throw e; - } + console.error(e); + throw e; } // lazy hack diff --git a/js/libtextsecure.js b/js/libtextsecure.js index a29c157c..7ad30854 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -39500,11 +39500,9 @@ function generateKeys(count, progressCallback) { if (e.code === 1006) { // possible 403. Make an request to confirm TextSecureServer.getDevices(textsecure.storage.user.getNumber()).catch(function(e) { - if (e.name === 'HTTPError' && (e.code == 401 || e.code == 403)) { - var ev = new Event('error'); - ev.error = e; - eventTarget.dispatchEvent(ev); - } + var ev = new Event('error'); + ev.error = e; + eventTarget.dispatchEvent(ev); }); } } diff --git a/libtextsecure/message_receiver.js b/libtextsecure/message_receiver.js index 114c8cc3..da39d6d8 100644 --- a/libtextsecure/message_receiver.js +++ b/libtextsecure/message_receiver.js @@ -37,13 +37,9 @@ if (e.code === 1006) { // possible 403. Make an request to confirm TextSecureServer.getDevices(textsecure.storage.user.getNumber()).catch(function(e) { - if (e.name === 'HTTPError' && (e.code == 401 || e.code == 403)) { - var ev = new Event('error'); - ev.error = e; - eventTarget.dispatchEvent(ev); - } else { - throw e; - } + var ev = new Event('error'); + ev.error = e; + eventTarget.dispatchEvent(ev); }); } }