try to call out when #187 happens

This commit is contained in:
Bruno Windels 2020-11-05 22:39:32 +01:00
parent c696a75f88
commit e0c8be3a9a

View file

@ -32,11 +32,22 @@ class RequestWrapper {
throw new HomeServerError(method, url, response.body, response.status);
}
}
}, err => {
// if this._requestResult is still set, the abort error came not from calling abort here
if (err.name === "AbortError" && this._requestResult) {
throw new Error(`Request ${method} ${url} was unexpectedly aborted, see #187.`);
} else {
throw err;
}
});
}
abort() {
return this._requestResult.abort();
if (this._requestResult) {
this._requestResult.abort();
// to mark that it was on purpose in above rejection handler
this._requestResult = null;
}
}
response() {