Handle invalid responses better
Depending on the response code, returning an HTTPError here will let us retry later, if appropriate. // FREEBIE
This commit is contained in:
parent
7bf94c33d5
commit
acae4afce3
2 changed files with 4 additions and 2 deletions
|
@ -36232,7 +36232,8 @@ var TextSecureServer = (function() {
|
|||
try { result = JSON.parse(xhr.responseText + ''); } catch(e) {}
|
||||
if (options.validateResponse) {
|
||||
if (!validateResponse(result, options.validateResponse)) {
|
||||
reject(new Error('Invalid response'));
|
||||
console.log(options.type, url, xhr.status, 'Error');
|
||||
reject(HTTPError(xhr.status, result, options.stack));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,8 @@ var TextSecureServer = (function() {
|
|||
try { result = JSON.parse(xhr.responseText + ''); } catch(e) {}
|
||||
if (options.validateResponse) {
|
||||
if (!validateResponse(result, options.validateResponse)) {
|
||||
reject(new Error('Invalid response'));
|
||||
console.log(options.type, url, xhr.status, 'Error');
|
||||
reject(HTTPError(xhr.status, result, options.stack));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue