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:
parent
a98de39173
commit
28c82531d3
1 changed files with 2 additions and 2 deletions
|
@ -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…
Reference in a new issue