mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +02:00
Prevent "Uncaught promise" messages in the console when cancelling (some) ReadableStream
s
While fixing issue 13794, I noticed that cancelling the `ReadableStream` returned by the `PDFPageProxy.streamTextContent`-method could lead to "Uncaught promise" messages in the console.[1] Generally speaking, we don't really care about errors when *cancelling* a `ReadableStream` and it thus seems reasonable to simply suppress any output in those cases. --- [1] Although, after that issue was fixed you'd now need to set the API-option `stopAtErrors = true` to actually trigger this.
This commit is contained in:
parent
4ad5c5d52a
commit
1df9da949e
2 changed files with 12 additions and 5 deletions
|
@ -1802,7 +1802,11 @@ class PDFPageProxy {
|
|||
return;
|
||||
}
|
||||
}
|
||||
intentState.streamReader.cancel(new AbortException(reason?.message));
|
||||
intentState.streamReader
|
||||
.cancel(new AbortException(reason?.message))
|
||||
.catch(() => {
|
||||
// Avoid "Uncaught promise" messages in the console.
|
||||
});
|
||||
intentState.streamReader = null;
|
||||
|
||||
if (this._transport.destroyed) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue