Skip to content

Commit 6537e64

Browse files
Merge pull request #12136 from Snuffleupagus/PDFFetchStreamRangeReader-AbortError
Ignore `fetch()` errors, in `PDFFetchStreamRangeReader`, once the request has been aborted
2 parents bcbbd03 + 1b720a4 commit 6537e64

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/display/fetch_stream.js

+14-7
Original file line numberDiff line numberDiff line change
@@ -243,13 +243,20 @@ class PDFFetchStreamRangeReader {
243243
this._withCredentials,
244244
this._abortController
245245
)
246-
).then(response => {
247-
if (!validateResponseStatus(response.status)) {
248-
throw createResponseStatusError(response.status, url);
249-
}
250-
this._readCapability.resolve();
251-
this._reader = response.body.getReader();
252-
});
246+
)
247+
.then(response => {
248+
if (!validateResponseStatus(response.status)) {
249+
throw createResponseStatusError(response.status, url);
250+
}
251+
this._readCapability.resolve();
252+
this._reader = response.body.getReader();
253+
})
254+
.catch(reason => {
255+
if (reason && reason.name === "AbortError") {
256+
return;
257+
}
258+
throw reason;
259+
});
253260

254261
this.onProgress = null;
255262
}

0 commit comments

Comments
 (0)