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 => { err => {
timeout.abort(); timeout.abort();
// map error to TimeoutError // map error to TimeoutError
if (err instanceof AbortError && timedOut) { if (err.name === "AbortError" && timedOut) {
throw new ConnectionError(`Request timed out after ${timeoutAmount}ms`, true); throw new ConnectionError(`Request timed out after ${timeoutAmount}ms`, true);
} else { } else {
throw err; throw err;