From e0c8be3a9a31c7359aedda99acbca3cd2e130d91 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 5 Nov 2020 22:39:32 +0100 Subject: [PATCH] try to call out when #187 happens --- src/matrix/net/HomeServerApi.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/matrix/net/HomeServerApi.js b/src/matrix/net/HomeServerApi.js index 55f36cd5..e6c97433 100644 --- a/src/matrix/net/HomeServerApi.js +++ b/src/matrix/net/HomeServerApi.js @@ -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() {