diff --git a/js/libtextsecure.js b/js/libtextsecure.js index f1a5c698d..632f70f50 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -38733,7 +38733,6 @@ var TextSecureServer = (function() { function promise_ajax(url, options) { return new Promise(function (resolve, reject) { console.log(options.type, url); - var error = new Error(); // just in case, save stack here. var xhr = new XMLHttpRequest(); xhr.open(options.type, url, true /*async*/); @@ -38761,18 +38760,19 @@ var TextSecureServer = (function() { resolve(result, xhr.status); } else { console.log(options.type, url, xhr.status, 'Error'); - reject(HTTPError(xhr.status, result, error.stack)); + reject(HTTPError(xhr.status, result, options.stack)); } }; xhr.onerror = function() { console.log(options.type, url, xhr.status, 'Error'); - reject(HTTPError(xhr.status, null, error.stack)); + reject(HTTPError(xhr.status, null, options.stack)); }; xhr.send( options.data || null ); }); } function ajax(url, options) { + options.stack = new Error().stack; // just in case, save stack here. var count = 3; function retry(e) { diff --git a/libtextsecure/api.js b/libtextsecure/api.js index 941229f6b..8b4a137f9 100644 --- a/libtextsecure/api.js +++ b/libtextsecure/api.js @@ -9,7 +9,6 @@ var TextSecureServer = (function() { function promise_ajax(url, options) { return new Promise(function (resolve, reject) { console.log(options.type, url); - var error = new Error(); // just in case, save stack here. var xhr = new XMLHttpRequest(); xhr.open(options.type, url, true /*async*/); @@ -37,18 +36,19 @@ var TextSecureServer = (function() { resolve(result, xhr.status); } else { console.log(options.type, url, xhr.status, 'Error'); - reject(HTTPError(xhr.status, result, error.stack)); + reject(HTTPError(xhr.status, result, options.stack)); } }; xhr.onerror = function() { console.log(options.type, url, xhr.status, 'Error'); - reject(HTTPError(xhr.status, null, error.stack)); + reject(HTTPError(xhr.status, null, options.stack)); }; xhr.send( options.data || null ); }); } function ajax(url, options) { + options.stack = new Error().stack; // just in case, save stack here. var count = 3; function retry(e) {