Convert throwHumanError to custom error type

Now with 200% more helpful stack traces.

// FREEBIE
This commit is contained in:
lilia 2015-07-10 11:28:47 -07:00
parent e86c40d3a8
commit 3711e0a6cd
6 changed files with 111 additions and 128 deletions

View file

@ -37,10 +37,12 @@
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.message == 401 || e.message == 403)) {
if (e.name === 'HTTPError' && (e.code == 401 || e.code == 403)) {
var ev = new Event('error');
ev.error = e;
eventTarget.dispatchEvent(ev);
} else {
throw e;
}
});
}