Merge pull request #10504 from Snuffleupagus/eslint-no-useless-catch

Enable the `no-useless-catch` ESLint rule
This commit is contained in:
Tim van der Meij 2019-01-28 22:37:14 +01:00 committed by GitHub
commit 55b12f5fd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 8 deletions

View File

@ -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"],

View File

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