Dispatch all network errors, not just auth errors
Also streamline the onError handler.
This commit is contained in:
parent
b40a8696b7
commit
6e74ac9e28
3 changed files with 24 additions and 31 deletions
|
@ -125,11 +125,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ev.proto) {
|
if (ev.proto) {
|
||||||
console.log(e);
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
|
|
||||||
var envelope = ev.proto;
|
var envelope = ev.proto;
|
||||||
var message = initIncomingMessage(envelope.source, envelope.timestamp.toNumber());
|
var message = initIncomingMessage(envelope.source, envelope.timestamp.toNumber());
|
||||||
if (e.name === 'IncomingIdentityKeyError') {
|
if (e.name === 'IncomingIdentityKeyError') {
|
||||||
|
@ -137,17 +133,20 @@
|
||||||
extension.trigger('updateInbox');
|
extension.trigger('updateInbox');
|
||||||
notifyConversation(message);
|
notifyConversation(message);
|
||||||
});
|
});
|
||||||
|
return;
|
||||||
} else if (e.message !== 'Bad MAC') {
|
} else if (e.message !== 'Bad MAC') {
|
||||||
message.save({ errors : [ _.pick(e, ['name', 'message'])]}).then(function() {
|
message.save({ errors : [ _.pick(e, ['name', 'message'])]}).then(function() {
|
||||||
extension.trigger('updateInbox');
|
extension.trigger('updateInbox');
|
||||||
notifyConversation(message);
|
notifyConversation(message);
|
||||||
});
|
});
|
||||||
} else {
|
return;
|
||||||
console.log(e);
|
|
||||||
throw e;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.error(e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
// lazy hack
|
// lazy hack
|
||||||
window.receipts = new Backbone.Collection();
|
window.receipts = new Backbone.Collection();
|
||||||
|
|
||||||
|
|
|
@ -39500,11 +39500,9 @@ function generateKeys(count, progressCallback) {
|
||||||
if (e.code === 1006) {
|
if (e.code === 1006) {
|
||||||
// possible 403. Make an request to confirm
|
// possible 403. Make an request to confirm
|
||||||
TextSecureServer.getDevices(textsecure.storage.user.getNumber()).catch(function(e) {
|
TextSecureServer.getDevices(textsecure.storage.user.getNumber()).catch(function(e) {
|
||||||
if (e.name === 'HTTPError' && (e.code == 401 || e.code == 403)) {
|
|
||||||
var ev = new Event('error');
|
var ev = new Event('error');
|
||||||
ev.error = e;
|
ev.error = e;
|
||||||
eventTarget.dispatchEvent(ev);
|
eventTarget.dispatchEvent(ev);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,13 +37,9 @@
|
||||||
if (e.code === 1006) {
|
if (e.code === 1006) {
|
||||||
// possible 403. Make an request to confirm
|
// possible 403. Make an request to confirm
|
||||||
TextSecureServer.getDevices(textsecure.storage.user.getNumber()).catch(function(e) {
|
TextSecureServer.getDevices(textsecure.storage.user.getNumber()).catch(function(e) {
|
||||||
if (e.name === 'HTTPError' && (e.code == 401 || e.code == 403)) {
|
|
||||||
var ev = new Event('error');
|
var ev = new Event('error');
|
||||||
ev.error = e;
|
ev.error = e;
|
||||||
eventTarget.dispatchEvent(ev);
|
eventTarget.dispatchEvent(ev);
|
||||||
} else {
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue