diff --git a/src/display/api.js b/src/display/api.js index 2f8d5d144..ff76f6429 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -1772,7 +1772,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) { diff --git a/src/display/text_layer.js b/src/display/text_layer.js index a56d17512..b1b22ec1a 100644 --- a/src/display/text_layer.js +++ b/src/display/text_layer.js @@ -597,7 +597,7 @@ class TextLayerRenderTask { } }) .catch(() => { - /* Avoid "Uncaught promise" messages in the console. */ + // Avoid "Uncaught promise" messages in the console. }); } @@ -615,7 +615,11 @@ class TextLayerRenderTask { cancel() { this._canceled = true; if (this._reader) { - this._reader.cancel(new AbortException("TextLayer task cancelled.")); + this._reader + .cancel(new AbortException("TextLayer task cancelled.")) + .catch(() => { + // Avoid "Uncaught promise" messages in the console. + }); this._reader = null; } if (this._renderTimer !== null) { @@ -741,8 +745,7 @@ class TextLayerRenderTask { pump(); } else { throw new Error( - 'Neither "textContent" nor "textContentStream"' + - " parameters specified." + 'Neither "textContent" nor "textContentStream" parameters specified.' ); }