From 81dfdd959ffef45c4db9f8f3fb2633148f99a684 Mon Sep 17 00:00:00 2001 From: lilia Date: Tue, 24 May 2016 11:36:04 -0700 Subject: [PATCH] Don't allow retry on unregistered user errors // FREEBIE --- js/libtextsecure.js | 4 ++-- libtextsecure/outgoing_message.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/js/libtextsecure.js b/js/libtextsecure.js index 05707f29..eea7ce22 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -38514,7 +38514,7 @@ OutgoingMessage.prototype = { } }, registerError: function(number, reason, error) { - if (!error || error.name === 'HTTPError') { + if (!error || error.name === 'HTTPError' && error.code !== 404) { error = new textsecure.OutgoingMessageError(number, this.message.toArrayBuffer(), this.timestamp, error); } @@ -38570,7 +38570,7 @@ OutgoingMessage.prototype = { transmitMessage: function(number, jsonData, timestamp) { return this.server.sendMessages(number, jsonData, timestamp).catch(function(e) { - if (e.name === 'HTTPError' && (e.code !== 409 && e.code !== 410)) { + if (e.name === 'HTTPError' && (e.code !== 409 && e.code !== 410 && e.code !== 404)) { // 409 and 410 should bubble and be handled by doSendMessage // all other network errors can be retried later. throw new textsecure.SendMessageNetworkError(number, jsonData, e, timestamp); diff --git a/libtextsecure/outgoing_message.js b/libtextsecure/outgoing_message.js index 6db428c5..316eb299 100644 --- a/libtextsecure/outgoing_message.js +++ b/libtextsecure/outgoing_message.js @@ -23,7 +23,7 @@ OutgoingMessage.prototype = { } }, registerError: function(number, reason, error) { - if (!error || error.name === 'HTTPError') { + if (!error || error.name === 'HTTPError' && error.code !== 404) { error = new textsecure.OutgoingMessageError(number, this.message.toArrayBuffer(), this.timestamp, error); } @@ -79,7 +79,7 @@ OutgoingMessage.prototype = { transmitMessage: function(number, jsonData, timestamp) { return this.server.sendMessages(number, jsonData, timestamp).catch(function(e) { - if (e.name === 'HTTPError' && (e.code !== 409 && e.code !== 410)) { + if (e.name === 'HTTPError' && (e.code !== 409 && e.code !== 410 && e.code !== 404)) { // 409 and 410 should bubble and be handled by doSendMessage // all other network errors can be retried later. throw new textsecure.SendMessageNetworkError(number, jsonData, e, timestamp);