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:
Jonas Jenwald 2014-09-13 16:47:16 +02:00
parent 27a80f3b88
commit ed5fc43510
5 changed files with 45 additions and 24 deletions

View file

@ -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];