Fix tracker do not throw AbortError (#2022)

* fix(tracker): patch network error handling

* fix(fetchProxy): remove remaining void operator
This commit is contained in:
PiR 2024-04-03 10:25:16 +02:00 committed by GitHub
parent 5356d72417
commit c17dd3c227
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -262,8 +262,8 @@ export class FetchProxyHandler<T extends typeof fetch> implements ProxyHandler<T
// so it's completed and can be cloned for `text()` calling. // so it's completed and can be cloned for `text()` calling.
item.readyState = 4 item.readyState = 4
void this.handleResponseBody(resp.clone(), item).then( this.handleResponseBody(resp.clone(), item)
(responseValue: string | ArrayBuffer) => { .then((responseValue: string | ArrayBuffer) => {
item.responseSize = item.responseSize =
typeof responseValue === 'string' ? responseValue.length : responseValue.byteLength typeof responseValue === 'string' ? responseValue.length : responseValue.byteLength
item.responseSizeText = formatByteSize(item.responseSize) item.responseSizeText = formatByteSize(item.responseSize)
@ -273,8 +273,14 @@ export class FetchProxyHandler<T extends typeof fetch> implements ProxyHandler<T
if (msg) { if (msg) {
this.sendMessage(msg) this.sendMessage(msg)
} }
}, })
) .catch((e) => {
if (e.name !== 'AbortError') {
throw e
} else {
// ignore AbortError
}
})
} }
return new Proxy(resp, new ResponseProxyHandler(resp, item)) return new Proxy(resp, new ResponseProxyHandler(resp, item))