detect abort error by name here too

This commit is contained in:
Bruno Windels 2020-10-30 09:55:03 +01:00
parent 3008367307
commit 0691f34650

View file

@ -41,7 +41,7 @@ export function abortOnTimeout(createTimeout, timeoutAmount, requestResult, resp
err => {
timeout.abort();
// map error to TimeoutError
if (err instanceof AbortError && timedOut) {
if (err.name === "AbortError" && timedOut) {
throw new ConnectionError(`Request timed out after ${timeoutAmount}ms`, true);
} else {
throw err;