Skip to content
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Module._findPath = (request, paths, isMain) => {
if (!r && hacks.includes(request)) {
try {
return require.resolve(`./tools/node_modules/${request}`);
} catch (err) {
} catch {
return require.resolve(
`./tools/node_modules/eslint/node_modules/${request}`);
}
Expand Down Expand Up @@ -212,7 +212,7 @@ module.exports = {
'no-unsafe-finally': 'error',
'no-unsafe-negation': 'error',
'no-unused-labels': 'error',
'no-unused-vars': ['error', { args: 'none' }],
'no-unused-vars': ['error', { args: 'none', caughtErrors: 'all' }],
'no-use-before-define': ['error', {
classes: true,
functions: false,
Expand Down
4 changes: 2 additions & 2 deletions benchmark/_http-benchmarkers.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class AutocannonBenchmarker {
let result;
try {
result = JSON.parse(output);
} catch (err) {
} catch {
return undefined;
}
if (!result || !result.requests || !result.requests.average) {
Expand Down Expand Up @@ -106,7 +106,7 @@ class TestDoubleBenchmarker {
let result;
try {
result = JSON.parse(output);
} catch (err) {
} catch {
return undefined;
}
return result.throughput;
Expand Down
2 changes: 1 addition & 1 deletion benchmark/child_process/child-process-exec-stdout.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function childProcessExecStdout({ dur, len }) {
// Sometimes there's a yes.exe process left hanging around on Windows.
try {
execSync(`taskkill /f /t /pid ${child.pid}`);
} catch (_) {
} catch {
// this is a best effort kill. stderr is piped to parent for tracing.
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions benchmark/fs/read-stream-throughput.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function runTest() {
});

rs.on('end', function() {
try { fs.unlinkSync(filename); } catch (e) {}
try { fs.unlinkSync(filename); } catch {}
// MB/sec
bench.end(bytes / (1024 * 1024));
});
Expand All @@ -74,7 +74,7 @@ function makeFile() {
buf.fill('x');
}

try { fs.unlinkSync(filename); } catch (e) {}
try { fs.unlinkSync(filename); } catch {}
var w = 1024;
const ws = fs.createWriteStream(filename);
ws.on('close', runTest);
Expand Down
4 changes: 2 additions & 2 deletions benchmark/fs/readfile-partitioned.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const bench = common.createBenchmark(main, {

function main(conf) {
const len = +conf.len;
try { fs.unlinkSync(filename); } catch (e) {}
try { fs.unlinkSync(filename); } catch {}
var data = Buffer.alloc(len, 'x');
fs.writeFileSync(filename, data);
data = null;
Expand All @@ -39,7 +39,7 @@ function main(conf) {
const totalOps = reads + zips;
benchEnded = true;
bench.end(totalOps);
try { fs.unlinkSync(filename); } catch (e) {}
try { fs.unlinkSync(filename); } catch {}
}, +conf.dur * 1000);

function read() {
Expand Down
4 changes: 2 additions & 2 deletions benchmark/fs/readfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const bench = common.createBenchmark(main, {
});

function main({ len, dur, concurrent }) {
try { fs.unlinkSync(filename); } catch (e) {}
try { fs.unlinkSync(filename); } catch {}
var data = Buffer.alloc(len, 'x');
fs.writeFileSync(filename, data);
data = null;
Expand All @@ -28,7 +28,7 @@ function main({ len, dur, concurrent }) {
setTimeout(function() {
benchEnded = true;
bench.end(reads);
try { fs.unlinkSync(filename); } catch (e) {}
try { fs.unlinkSync(filename); } catch {}
process.exit(0);
}, dur * 1000);

Expand Down
4 changes: 2 additions & 2 deletions benchmark/fs/write-stream-throughput.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function main({ dur, encodingType, size }) {
throw new Error(`invalid encodingType: ${encodingType}`);
}

try { fs.unlinkSync(filename); } catch (e) {}
try { fs.unlinkSync(filename); } catch {}

var started = false;
var ended = false;
Expand All @@ -45,7 +45,7 @@ function main({ dur, encodingType, size }) {
f.on('finish', function() {
ended = true;
const written = fs.statSync(filename).size / 1024;
try { fs.unlinkSync(filename); } catch (e) {}
try { fs.unlinkSync(filename); } catch {}
bench.end(written / 1024);
});

Expand Down
2 changes: 1 addition & 1 deletion benchmark/misc/punycode.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const common = require('../common.js');
let icu;
try {
icu = common.binding('icu');
} catch (err) {}
} catch {}
const punycode = require('punycode');

const bench = common.createBenchmark(main, {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/module/module-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const bench = common.createBenchmark(main, {

function main({ n, fullPath, useCache }) {
tmpdir.refresh();
try { fs.mkdirSync(benchmarkDirectory); } catch (e) {}
try { fs.mkdirSync(benchmarkDirectory); } catch {}
for (var i = 0; i <= n; i++) {
fs.mkdirSync(`${benchmarkDirectory}${i}`);
fs.writeFileSync(
Expand Down
4 changes: 2 additions & 2 deletions benchmark/napi/function_args/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ let napi;

try {
v8 = require('./build/Release/binding');
} catch (err) {
} catch {
console.error(`${__filename}: V8 Binding failed to load`);
process.exit(0);
}

try {
napi = require('./build/Release/napi_binding');
} catch (err) {
} catch {
console.error(`${__filename}: NAPI-Binding failed to load`);
process.exit(0);
}
Expand Down
4 changes: 2 additions & 2 deletions benchmark/napi/function_call/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const common = require('../../common.js');

try {
var binding = require('./build/Release/binding');
} catch (er) {
} catch {
console.error('misc/function_call.js Binding failed to load');
process.exit(0);
}
Expand All @@ -22,7 +22,7 @@ const cxx = binding.hello;
let napi_binding;
try {
napi_binding = require('./build/Release/napi_binding');
} catch (er) {
} catch {
console.error('misc/function_call/index.js NAPI-Binding failed to load');
process.exit(0);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ function getErrMessage(message, fn) {
errorCache.set(identifier, message);

return message;
} catch (e) {
// Invalidate cache to prevent trying to read this part again.
} catch {
// Invalidate cache to prevent trying to read this part again.
errorCache.set(identifier, undefined);
} finally {
// Reset limit.
Expand Down
2 changes: 1 addition & 1 deletion lib/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ EventEmitter.prototype.emit = function emit(type, ...args) {
value: enhanceStackTrace.bind(null, er, capture),
configurable: true
});
} catch (e) {}
} catch {}

// Note: The comments on the `throw` lines are intentional, they show
// up in Node's output if this results in an unhandled exception.
Expand Down
4 changes: 2 additions & 2 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ function exists(path, callback) {

try {
fs.access(path, F_OK, suppressedCallback);
} catch (err) {
} catch {
return callback(false);
}
}
Expand All @@ -230,7 +230,7 @@ function existsSync(path) {
try {
path = toPathIfFileURL(path);
validatePath(path);
} catch (e) {
} catch {
return false;
}
const ctx = { path };
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/bootstrap/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@
function tryGetCwd(path) {
try {
return process.cwd();
} catch (ex) {
} catch {
// getcwd(3) can fail if the current working directory has been deleted.
// Fall back to the directory name of the (absolute) executable path.
// It's not really correct but what are the alternatives?
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/modules/esm/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Loader {
if (this._resolve !== defaultResolve) {
try {
new URL(url);
} catch (e) {
} catch {
throw new ERR_INVALID_RETURN_PROPERTY(
'url', 'loader resolve', 'url', url
);
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/util/inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function sendInspectorCommand(cb, onError) {
} finally {
session.disconnect();
}
} catch (e) {
} catch {
return onError();
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/v8_prof_polyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function macCppfiltNm(out) {
filtered = cp.spawnSync('c++filt', [ '-p' , '-i' ], {
input: entries.join('\n')
}).stdout.toString();
} catch (e) {
} catch {
return out;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/querystring.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ function parse(qs, sep, eq, options) {
function decodeStr(s, decoder) {
try {
return decoder(s);
} catch (e) {
} catch {
return QueryString.unescape(s, true);
}
}
16 changes: 8 additions & 8 deletions lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const kContextId = Symbol('contextId');
try {
// Hack for require.resolve("./relative") to work properly.
module.filename = path.resolve('repl');
} catch (e) {
} catch {
// path.resolve('repl') fails when the current working directory has been
// deleted. Fall back to the directory name of the (absolute) executable
// path. It's not really correct but what are the alternatives?
Expand Down Expand Up @@ -1051,7 +1051,7 @@ function complete(line, callback) {
dir = path.resolve(paths[i], subdir);
try {
files = fs.readdirSync(dir);
} catch (e) {
} catch {
continue;
}
for (f = 0; f < files.length; f++) {
Expand All @@ -1065,14 +1065,14 @@ function complete(line, callback) {
abs = path.resolve(dir, name);
try {
isDirectory = fs.statSync(abs).isDirectory();
} catch (e) {
} catch {
continue;
}
if (isDirectory) {
group.push(subdir + name + '/');
try {
subfiles = fs.readdirSync(abs);
} catch (e) {
} catch {
continue;
}
for (s = 0; s < subfiles.length; s++) {
Expand Down Expand Up @@ -1154,13 +1154,13 @@ function complete(line, callback) {
});
}
} else {
const evalExpr = `try { ${expr} } catch (e) {}`;
const evalExpr = `try { ${expr} } catch {}`;
this.eval(evalExpr, this.context, 'repl', (e, obj) => {
if (obj != null) {
if (typeof obj === 'object' || typeof obj === 'function') {
try {
memberGroups.push(filteredOwnPropertyNames.call(this, obj));
} catch (ex) {
} catch {
// Probably a Proxy object without `getOwnPropertyNames` trap.
// We simply ignore it here, as we don't want to break the
// autocompletion. Fixes the bug
Expand All @@ -1185,7 +1185,7 @@ function complete(line, callback) {
break;
}
}
} catch (e) {}
} catch {}
}

if (memberGroups.length) {
Expand Down Expand Up @@ -1458,7 +1458,7 @@ function defineDefaultCommands(repl) {
try {
fs.writeFileSync(file, this.lines.join('\n') + '\n');
this.outputStream.write('Session saved to: ' + file + '\n');
} catch (e) {
} catch {
this.outputStream.write('Failed to save: ' + file + '\n');
}
this.displayPrompt();
Expand Down
4 changes: 2 additions & 2 deletions lib/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ try {
// readable-stream.
Stream._isUint8Array = process.binding('util').isUint8Array;
}
} catch (e) {
} catch (e) { // eslint-disable-line no-unused-vars
}

if (!Stream._isUint8Array) {
Expand All @@ -74,7 +74,7 @@ if (version[0] === 0 && version[1] < 12) {
chunk.byteOffset,
chunk.byteLength);
};
} catch (e) {
} catch (e) { // eslint-disable-line no-unused-vars
}

if (!Stream._uint8ArrayToBuffer) {
Expand Down
8 changes: 4 additions & 4 deletions test/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ function canCreateSymLink() {
try {
const output = execSync(`${whoamiPath} /priv`, { timout: 1000 });
return output.includes('SeCreateSymbolicLinkPrivilege');
} catch (e) {
} catch {
return false;
}
}
Expand Down Expand Up @@ -456,7 +456,7 @@ function isAlive(pid) {
try {
process.kill(pid, 'SIGCONT');
return true;
} catch (e) {
} catch {
return false;
}
}
Expand Down Expand Up @@ -665,7 +665,7 @@ function getTTYfd() {
if (ttyFd === undefined) {
try {
return fs.openSync('/dev/tty');
} catch (e) {
} catch {
// There aren't any tty fd's available to use.
return -1;
}
Expand All @@ -679,7 +679,7 @@ function runWithInvalidFD(func) {
// be an valid one.
try {
while (fs.fstatSync(fd--) && fd > 0);
} catch (e) {
} catch {
return func(fd);
}

Expand Down
2 changes: 1 addition & 1 deletion test/doctool/test-doctool-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const common = require('../common');
// The doctool currently uses js-yaml from the tool/node_modules/eslint/ tree.
try {
require('../../tools/node_modules/eslint/node_modules/js-yaml');
} catch (e) {
} catch {
common.skip('missing js-yaml (eslint not present)');
}

Expand Down
2 changes: 1 addition & 1 deletion test/doctool/test-doctool-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const common = require('../common');
// The doctool currently uses js-yaml from the tool/node_modules/eslint/ tree.
try {
require('../../tools/node_modules/eslint/node_modules/js-yaml');
} catch (e) {
} catch {
common.skip('missing js-yaml (eslint not present)');
}

Expand Down
Loading