[Pkg-javascript-commits] [pdf.js] 49/204: Change `getDocumentError` in web/viewer.js to use `instanceof` instead of the exception name
David Prévot
taffit at moszumanska.debian.org
Sat Oct 25 18:50:29 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit 2701edc7c63963d603b87ae717c4b45c660ac1e8
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date: Mon Sep 8 22:32:14 2014 +0200
Change `getDocumentError` in web/viewer.js to use `instanceof` instead of the exception name
---
src/shared/util.js | 4 ++++
web/viewer.js | 13 +++----------
2 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/src/shared/util.js b/src/shared/util.js
index 201ca3e..9d0d297 100644
--- a/src/shared/util.js
+++ b/src/shared/util.js
@@ -342,6 +342,7 @@ var PasswordException = (function PasswordExceptionClosure() {
return PasswordException;
})();
+PDFJS.PasswordException = PasswordException;
var UnknownErrorException = (function UnknownErrorExceptionClosure() {
function UnknownErrorException(msg, details) {
@@ -355,6 +356,7 @@ var UnknownErrorException = (function UnknownErrorExceptionClosure() {
return UnknownErrorException;
})();
+PDFJS.UnknownErrorException = UnknownErrorException;
var InvalidPDFException = (function InvalidPDFExceptionClosure() {
function InvalidPDFException(msg) {
@@ -367,6 +369,7 @@ var InvalidPDFException = (function InvalidPDFExceptionClosure() {
return InvalidPDFException;
})();
+PDFJS.InvalidPDFException = InvalidPDFException;
var MissingPDFException = (function MissingPDFExceptionClosure() {
function MissingPDFException(msg) {
@@ -379,6 +382,7 @@ var MissingPDFException = (function MissingPDFExceptionClosure() {
return MissingPDFException;
})();
+PDFJS.MissingPDFException = MissingPDFException;
var NotImplementedException = (function NotImplementedExceptionClosure() {
function NotImplementedException(msg) {
diff --git a/web/viewer.js b/web/viewer.js
index 7574fef..d332a5e 100644
--- a/web/viewer.js
+++ b/web/viewer.js
@@ -673,15 +673,11 @@ var PDFView = {
self.loading = false;
},
function getDocumentError(exception) {
- var name, message;
- if (exception) {
- name = exception.name;
- message = exception.message;
- }
+ var message = exception && exception.message;
var loadingErrorMessage = mozL10n.get('loading_error', null,
'An error occurred while loading the PDF.');
- if (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.');
@@ -689,13 +685,10 @@ var PDFView = {
// window.alert(loadingErrorMessage);
// return window.close();
//#endif
- }
-
- if (name === 'MissingPDFException') {
+ } 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();
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list