diff --git a/.eslintrc b/.eslintrc index 7b6dbf980..c6bef1304 100644 --- a/.eslintrc +++ b/.eslintrc @@ -88,6 +88,7 @@ "no-unused-expressions": "error", "no-unused-labels": "error", "no-useless-call": "error", + "no-useless-catch": "error", "no-useless-concat": "error", "prefer-promise-reject-errors": "error", "wrap-iife": ["error", "any"], diff --git a/web/app.js b/web/app.js index 26da5e818..0d09e67ef 100644 --- a/web/app.js +++ b/web/app.js @@ -1621,17 +1621,13 @@ if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) { // cannot load file:-URLs in a Web Worker. file:-URLs are usually loaded // very quickly, so there is no need to set up progress event listeners. PDFViewerApplication.setTitleUsingUrl(file); - let xhr = new XMLHttpRequest(); + const xhr = new XMLHttpRequest(); xhr.onload = function() { PDFViewerApplication.open(new Uint8Array(xhr.response)); }; - try { - xhr.open('GET', file); - xhr.responseType = 'arraybuffer'; - xhr.send(); - } catch (ex) { - throw ex; - } + xhr.open('GET', file); + xhr.responseType = 'arraybuffer'; + xhr.send(); return; }