refactor: remove locally caught exceptions

This commit is contained in:
Jef LeCompte 2022-08-04 09:33:09 -07:00
parent 94f88d78c4
commit 3a1b76e782
No known key found for this signature in database
GPG key ID: 7F5BA322B5DC170C
2 changed files with 12 additions and 21 deletions

7
dist/setup/index.js vendored
View file

@ -71780,18 +71780,13 @@ function parseNodeVersionFile(contents) {
core.warning('Node version file is not JSON file');
}
if (!nodeVersion) {
try {
const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m);
nodeVersion = (_c = found === null || found === void 0 ? void 0 : found.groups) === null || _c === void 0 ? void 0 : _c.version;
if (!nodeVersion)
throw new Error();
}
catch (err) {
// In the case of an unknown format,
// return as is and evaluate the version separately.
if (!nodeVersion)
nodeVersion = contents.trim();
}
}
return nodeVersion;
}
exports.parseNodeVersionFile = parseNodeVersionFile;

View file

@ -506,17 +506,13 @@ export function parseNodeVersionFile(contents: string): string {
}
if (!nodeVersion) {
try {
const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m);
nodeVersion = found?.groups?.version;
}
if (!nodeVersion) throw new Error();
} catch (err) {
// In the case of an unknown format,
// return as is and evaluate the version separately.
nodeVersion = contents.trim();
}
}
if (!nodeVersion) nodeVersion = contents.trim();
return nodeVersion as string;
}