Skip to content

Commit

Permalink
Throw UnregisteredUserErrors in getKeysForNumber()
Browse files Browse the repository at this point in the history
  • Loading branch information
haffenloher authored and liliakai committed Feb 9, 2017
1 parent e8de2f0 commit d2ddfc7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions js/libtextsecure.js
Original file line number Diff line number Diff line change
Expand Up @@ -38640,8 +38640,9 @@ OutgoingMessage.prototype = {
updateDevices.forEach(function(device) {
promise = promise.then(function() {
return this.server.getKeysForNumber(number, device).then(handleResult).catch(function(e) {
if (e.name === 'HTTPError' && e.code === 404 && device !== 1) {
return this.removeDeviceIdsForNumber(number, [device]);
if (e.name === 'HTTPError' && e.code === 404) {
if (device !== 1) return this.removeDeviceIdsForNumber(number, [device]);
else throw new textsecure.UnregisteredUserError(number, e);
} else {
throw e;
}
Expand Down
5 changes: 3 additions & 2 deletions libtextsecure/outgoing_message.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ OutgoingMessage.prototype = {
updateDevices.forEach(function(device) {
promise = promise.then(function() {
return this.server.getKeysForNumber(number, device).then(handleResult).catch(function(e) {
if (e.name === 'HTTPError' && e.code === 404 && device !== 1) {
return this.removeDeviceIdsForNumber(number, [device]);
if (e.name === 'HTTPError' && e.code === 404) {
if (device !== 1) return this.removeDeviceIdsForNumber(number, [device]);
else throw new textsecure.UnregisteredUserError(number, e);
} else {
throw e;
}
Expand Down

0 comments on commit d2ddfc7

Please sign in to comment.