Allow promises to handle identity removal failure

Previously this exception was thrown in a callback which did not
propogate it up to the enclosing promise.

// FREEBIE
This commit is contained in:
lilia 2016-03-09 18:26:57 -08:00
parent a98de39173
commit 28c82531d3

View file

@ -292,12 +292,12 @@
});
},
removeIdentityKey: function(number) {
return new Promise(function(resolve) {
return new Promise(function(resolve, reject) {
var identityKey = new IdentityKey({id: number});
identityKey.fetch().then(function() {
identityKey.save({publicKey: undefined});
}).fail(function() {
throw new Error("Tried to remove identity for unknown number");
reject(new Error("Tried to remove identity for unknown number"));
});
resolve(textsecure.storage.axolotl.removeAllSessions(number));
});