Un-nest libtextsecure errors

Fix inconsistency in error format, where we sometimes get an unexpected
Error object and sometimes get a wrapper object containing an Error.

Also start saving network errors.

// FREEBIE
This commit is contained in:
lilia 2015-09-28 17:13:27 -07:00
parent 1879e73c76
commit 04c5f83485
3 changed files with 22 additions and 25 deletions

View file

@ -39758,11 +39758,13 @@ window.textsecure.messaging = function() {
callback({success: successfulNumbers, failure: errors});
};
var registerError = function(number, message, error) {
var registerError = function(number, reason, error) {
if (!error) {
error = new Error(message);
error = new Error(reason);
}
errors[errors.length] = { number: number, reason: message, error: error };
error.number = number;
error.reason = reason;
errors[errors.length] = error;
numberCompleted();
};