Change return type from sending messages

Pass the whole result from the outgoing message callback on to the
caller, and preserve the names of the members.

// FREEBIE
This commit is contained in:
lilia 2015-11-19 16:50:14 -08:00
parent 7b6820d2ac
commit 5c37c3d6ce
4 changed files with 15 additions and 15 deletions

View file

@ -37110,7 +37110,7 @@ OutgoingMessage.prototype = {
numberCompleted: function() { numberCompleted: function() {
this.numbersCompleted++; this.numbersCompleted++;
if (this.numbersCompleted >= this.numbers.length) { if (this.numbersCompleted >= this.numbers.length) {
this.callback({success: this.successfulNumbers, failure: this.errors}); this.callback({successfulNumbers: this.successfulNumbers, errors: this.errors});
} }
}, },
registerError: function(number, reason, error) { registerError: function(number, reason, error) {
@ -37326,10 +37326,10 @@ MessageSender.prototype = {
sendIndividualProto: function(number, proto, timestamp) { sendIndividualProto: function(number, proto, timestamp) {
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
this.sendMessageProto(timestamp, [number], proto, function(res) { this.sendMessageProto(timestamp, [number], proto, function(res) {
if (res.failure.length > 0) if (res.errors.length > 0)
reject(res.failure); reject(res);
else else
resolve(); resolve(res);
}); });
}.bind(this)); }.bind(this));
}, },
@ -37393,10 +37393,10 @@ MessageSender.prototype = {
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
this.sendMessageProto(timestamp, numbers, proto, function(res) { this.sendMessageProto(timestamp, numbers, proto, function(res) {
if (res.failure.length > 0) if (res.errors.length > 0)
reject(res.failure); reject(res);
else else
resolve(); resolve(res);
}); });
}.bind(this)).then(this.sendSyncMessage.bind(this, proto, timestamp)); }.bind(this)).then(this.sendSyncMessage.bind(this, proto, timestamp));
}, },

View file

@ -146,7 +146,7 @@
}.bind(this)).catch(function(errors) { }.bind(this)).catch(function(errors) {
this.trigger('done'); this.trigger('done');
this.set({sent: true}); this.set({sent: true});
this.saveErrors(errors); this.saveErrors(result.errors);
}.bind(this)); }.bind(this));
}, },

View file

@ -19,7 +19,7 @@ OutgoingMessage.prototype = {
numberCompleted: function() { numberCompleted: function() {
this.numbersCompleted++; this.numbersCompleted++;
if (this.numbersCompleted >= this.numbers.length) { if (this.numbersCompleted >= this.numbers.length) {
this.callback({success: this.successfulNumbers, failure: this.errors}); this.callback({successfulNumbers: this.successfulNumbers, errors: this.errors});
} }
}, },
registerError: function(number, reason, error) { registerError: function(number, reason, error) {

View file

@ -58,10 +58,10 @@ MessageSender.prototype = {
sendIndividualProto: function(number, proto, timestamp) { sendIndividualProto: function(number, proto, timestamp) {
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
this.sendMessageProto(timestamp, [number], proto, function(res) { this.sendMessageProto(timestamp, [number], proto, function(res) {
if (res.failure.length > 0) if (res.errors.length > 0)
reject(res.failure); reject(res);
else else
resolve(); resolve(res);
}); });
}.bind(this)); }.bind(this));
}, },
@ -125,10 +125,10 @@ MessageSender.prototype = {
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
this.sendMessageProto(timestamp, numbers, proto, function(res) { this.sendMessageProto(timestamp, numbers, proto, function(res) {
if (res.failure.length > 0) if (res.errors.length > 0)
reject(res.failure); reject(res);
else else
resolve(); resolve(res);
}); });
}.bind(this)).then(this.sendSyncMessage.bind(this, proto, timestamp)); }.bind(this)).then(this.sendSyncMessage.bind(this, proto, timestamp));
}, },