Remove non-standard bare-catch blocks (#1281)

Summary:
In ES6, the [`try` statement grammar][1] requires a catch parameter; the
parameter is only optional in the latest draft of ECMAScript, which is
of course not yet ratified as any actual standard.

Even though we don’t officially pledge to support Node 8, this is
currently the only breakage, and it’s easy enough to fix.

[1]: https://www.ecma-international.org/ecma-262/6.0/#sec-try-statement

Test Plan:
Running `yarn start` on Node v8.11.4 no longer raises a syntax error.

wchargin-branch: catch-parameter
This commit is contained in:
William Chargin 2019-08-13 09:41:45 -07:00 committed by GitHub
parent e256b73f3b
commit 68aad8b205
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,7 +26,7 @@ module.exports = async function getProjectIds(
let entries = []; let entries = [];
try { try {
entries = await fs.readdir(projectsPath); entries = await fs.readdir(projectsPath);
} catch { } catch (e) {
return []; return [];
} }
const getProjectId = async (entry) => { const getProjectId = async (entry) => {
@ -34,7 +34,7 @@ module.exports = async function getProjectIds(
const jsonPath = path.join(projectsPath, entry, "project.json"); const jsonPath = path.join(projectsPath, entry, "project.json");
await fs.stat(jsonPath); await fs.stat(jsonPath);
return base64url.decode(entry); return base64url.decode(entry);
} catch { } catch (e) {
return null; return null;
} }
}; };