mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 17:55:37 +02:00
Add |UnexpectedResponseException| to fix the exception handling when file loading fails because the server responds with a non 404 status message
This commit is contained in:
parent
27a80f3b88
commit
ed5fc43510
5 changed files with 45 additions and 24 deletions
|
@ -16,9 +16,9 @@
|
|||
*/
|
||||
/* globals PDFJS, isArrayBuffer, error, combineUrl, createPromiseCapability,
|
||||
StatTimer, globalScope, MessageHandler, info, FontLoader, Util, warn,
|
||||
PasswordResponses, PasswordException, InvalidPDFException,
|
||||
Promise, PasswordResponses, PasswordException, InvalidPDFException,
|
||||
MissingPDFException, UnknownErrorException, FontFace, loadJpegStream,
|
||||
createScratchCanvas, Promise, CanvasGraphics */
|
||||
createScratchCanvas, CanvasGraphics, UnexpectedResponseException */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -895,6 +895,12 @@ var WorkerTransport = (function WorkerTransportClosure() {
|
|||
new MissingPDFException(exception.message));
|
||||
}, this);
|
||||
|
||||
messageHandler.on('UnexpectedResponse',
|
||||
function transportUnexpectedResponse(exception) {
|
||||
this.workerReadyCapability.reject(
|
||||
new UnexpectedResponseException(exception.message, exception.status));
|
||||
}, this);
|
||||
|
||||
messageHandler.on('UnknownError',
|
||||
function transportUnknownError(exception) {
|
||||
this.workerReadyCapability.reject(
|
||||
|
@ -994,10 +1000,6 @@ var WorkerTransport = (function WorkerTransportClosure() {
|
|||
}
|
||||
}, this);
|
||||
|
||||
messageHandler.on('DocError', function transportDocError(data) {
|
||||
this.workerReadyCapability.reject(data);
|
||||
}, this);
|
||||
|
||||
messageHandler.on('PageError', function transportError(data) {
|
||||
var page = this.pageCache[data.pageNum - 1];
|
||||
var intentState = page.intentStates[data.intent];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue