Fix tracker do not throw AbortError (#2022)
* fix(tracker): patch network error handling * fix(fetchProxy): remove remaining void operator
This commit is contained in:
parent
5356d72417
commit
c17dd3c227
1 changed files with 10 additions and 4 deletions
|
|
@ -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))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue