mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 23:28:06 +02:00
Merge pull request #5275 from Snuffleupagus/exception-propagation
Fix the exception propagation when rejecting workerReadyCapability
This commit is contained in:
commit
ffb613bbac
6 changed files with 124 additions and 84 deletions
|
@ -677,30 +677,27 @@ var PDFView = {
|
|||
self.load(pdfDocument, scale);
|
||||
self.loading = false;
|
||||
},
|
||||
function getDocumentError(message, exception) {
|
||||
function getDocumentError(exception) {
|
||||
var message = exception && exception.message;
|
||||
var loadingErrorMessage = mozL10n.get('loading_error', null,
|
||||
'An error occurred while loading the PDF.');
|
||||
|
||||
if (exception && exception.name === 'InvalidPDFException') {
|
||||
if (exception instanceof PDFJS.InvalidPDFException) {
|
||||
// change error message also for other builds
|
||||
loadingErrorMessage = mozL10n.get('invalid_file_error', null,
|
||||
'Invalid or corrupted PDF file.');
|
||||
//#if B2G
|
||||
// window.alert(loadingErrorMessage);
|
||||
// return window.close();
|
||||
//#endif
|
||||
}
|
||||
|
||||
if (exception && exception.name === 'MissingPDFException') {
|
||||
'Invalid or corrupted PDF file.');
|
||||
} else if (exception instanceof PDFJS.MissingPDFException) {
|
||||
// special message for missing PDF's
|
||||
loadingErrorMessage = mozL10n.get('missing_file_error', null,
|
||||
'Missing PDF file.');
|
||||
|
||||
//#if B2G
|
||||
// window.alert(loadingErrorMessage);
|
||||
// return window.close();
|
||||
//#endif
|
||||
'Missing PDF file.');
|
||||
} else if (exception instanceof PDFJS.UnexpectedResponseException) {
|
||||
loadingErrorMessage = mozL10n.get('unexpected_response_error', null,
|
||||
'Unexpected server response.');
|
||||
}
|
||||
//#if B2G
|
||||
// window.alert(loadingErrorMessage);
|
||||
// return window.close();
|
||||
//#endif
|
||||
|
||||
var moreInfo = {
|
||||
message: message
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue