From 28c82531d3ec4f03f6f77f75cc0f336e3cc38282 Mon Sep 17 00:00:00 2001 From: lilia Date: Wed, 9 Mar 2016 18:26:57 -0800 Subject: [PATCH] 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 --- js/axolotl_store.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/axolotl_store.js b/js/axolotl_store.js index b47fc168b..9d4bf95e8 100644 --- a/js/axolotl_store.js +++ b/js/axolotl_store.js @@ -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)); });