feat #283: improve error message on timeout on browser platform

This commit is contained in:
Sefa Ilkimen
2020-01-27 04:44:13 +01:00
parent 662b4352f5
commit 7193b636f1
2 changed files with 11 additions and 1 deletions
+10 -1
View File
@@ -171,10 +171,19 @@ function sendRequest(method, withData, opts, success, failure) {
xhr.responseType = responseType;
setHeaders(xhr, headers);
xhr.onerror = xhr.ontimeout = function () {
xhr.onerror = function () {
return failure(createXhrFailureObject(xhr));
};
xhr.ontimeout = function () {
return failure({
status: -4,
error: 'Request timed out',
url: url,
headers: {}
});
};
xhr.onload = function () {
if (xhr.readyState !== xhr.DONE) return;