Merge pull request #14648 from overleaf/jdt-hist-req-errors

swallow abort error on parse fail if specified

GitOrigin-RevId: b2c049171e9a0c8bc5869a7ef7498134f8964318
This commit is contained in:
Rebeka Dekany 2023-09-05 11:25:11 +02:00 committed by Copybot
parent dac4d64716
commit 60dbcdd08e

View file

@ -153,6 +153,11 @@ function fetchJSON<T>(
}
},
error => {
// swallow the error if the fetch was cancelled (e.g. by cancelling an AbortController on component unmount)
if (swallowAbortError && error.name === 'AbortError') {
// the fetch request was aborted while reading/parsing the response body
return
}
// parsing the response body failed
reject(
new FetchError(
@ -168,6 +173,7 @@ function fetchJSON<T>(
error => {
// swallow the error if the fetch was cancelled (e.g. by cancelling an AbortController on component unmount)
if (swallowAbortError && error.name === 'AbortError') {
// the fetch request was aborted before a response was returned
return
}
// the fetch failed