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
pull/749/head
lilia 9 years ago
parent a98de39173
commit 28c82531d3

@ -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));
});

Loading…
Cancel
Save