Skip to content

Commit 40b3ad3

Browse files
cjihrigtargos
authored andcommitted
benchmark: remove unused catch bindings
PR-URL: #24079 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Wyatt Preul <wpreul@gmail.com>
1 parent a35bcd5 commit 40b3ad3

10 files changed

+17
-17
lines changed

benchmark/_http-benchmarkers.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class AutocannonBenchmarker {
3535
let result;
3636
try {
3737
result = JSON.parse(output);
38-
} catch (err) {
38+
} catch {
3939
return undefined;
4040
}
4141
if (!result || !result.requests || !result.requests.average) {
@@ -106,7 +106,7 @@ class TestDoubleBenchmarker {
106106
let result;
107107
try {
108108
result = JSON.parse(output);
109-
} catch (err) {
109+
} catch {
110110
return undefined;
111111
}
112112
return result.throughput;

benchmark/child_process/child-process-exec-stdout.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function childProcessExecStdout({ dur, len }) {
3030
// Sometimes there's a yes.exe process left hanging around on Windows.
3131
try {
3232
execSync(`taskkill /f /t /pid ${child.pid}`);
33-
} catch (_) {
33+
} catch {
3434
// this is a best effort kill. stderr is piped to parent for tracing.
3535
}
3636
} else {

benchmark/fs/read-stream-throughput.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function runTest() {
5555
});
5656

5757
rs.on('end', function() {
58-
try { fs.unlinkSync(filename); } catch (e) {}
58+
try { fs.unlinkSync(filename); } catch {}
5959
// MB/sec
6060
bench.end(bytes / (1024 * 1024));
6161
});
@@ -74,7 +74,7 @@ function makeFile() {
7474
buf.fill('x');
7575
}
7676

77-
try { fs.unlinkSync(filename); } catch (e) {}
77+
try { fs.unlinkSync(filename); } catch {}
7878
var w = 1024;
7979
const ws = fs.createWriteStream(filename);
8080
ws.on('close', runTest);

benchmark/fs/readfile-partitioned.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const bench = common.createBenchmark(main, {
2424

2525
function main(conf) {
2626
const len = +conf.len;
27-
try { fs.unlinkSync(filename); } catch (e) {}
27+
try { fs.unlinkSync(filename); } catch {}
2828
var data = Buffer.alloc(len, 'x');
2929
fs.writeFileSync(filename, data);
3030
data = null;
@@ -39,7 +39,7 @@ function main(conf) {
3939
const totalOps = reads + zips;
4040
benchEnded = true;
4141
bench.end(totalOps);
42-
try { fs.unlinkSync(filename); } catch (e) {}
42+
try { fs.unlinkSync(filename); } catch {}
4343
}, +conf.dur * 1000);
4444

4545
function read() {

benchmark/fs/readfile.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const bench = common.createBenchmark(main, {
1717
});
1818

1919
function main({ len, dur, concurrent }) {
20-
try { fs.unlinkSync(filename); } catch (e) {}
20+
try { fs.unlinkSync(filename); } catch {}
2121
var data = Buffer.alloc(len, 'x');
2222
fs.writeFileSync(filename, data);
2323
data = null;
@@ -28,7 +28,7 @@ function main({ len, dur, concurrent }) {
2828
setTimeout(function() {
2929
benchEnded = true;
3030
bench.end(reads);
31-
try { fs.unlinkSync(filename); } catch (e) {}
31+
try { fs.unlinkSync(filename); } catch {}
3232
process.exit(0);
3333
}, dur * 1000);
3434

benchmark/fs/write-stream-throughput.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function main({ dur, encodingType, size }) {
3333
throw new Error(`invalid encodingType: ${encodingType}`);
3434
}
3535

36-
try { fs.unlinkSync(filename); } catch (e) {}
36+
try { fs.unlinkSync(filename); } catch {}
3737

3838
var started = false;
3939
var ended = false;
@@ -45,7 +45,7 @@ function main({ dur, encodingType, size }) {
4545
f.on('finish', function() {
4646
ended = true;
4747
const written = fs.statSync(filename).size / 1024;
48-
try { fs.unlinkSync(filename); } catch (e) {}
48+
try { fs.unlinkSync(filename); } catch {}
4949
bench.end(written / 1024);
5050
});
5151

benchmark/misc/punycode.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const common = require('../common.js');
44
let icu;
55
try {
66
icu = common.binding('icu');
7-
} catch (err) {}
7+
} catch {}
88
const punycode = require('punycode');
99

1010
const bench = common.createBenchmark(main, {

benchmark/module/module-loader.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const bench = common.createBenchmark(main, {
1414

1515
function main({ n, fullPath, useCache }) {
1616
tmpdir.refresh();
17-
try { fs.mkdirSync(benchmarkDirectory); } catch (e) {}
17+
try { fs.mkdirSync(benchmarkDirectory); } catch {}
1818
for (var i = 0; i <= n; i++) {
1919
fs.mkdirSync(`${benchmarkDirectory}${i}`);
2020
fs.writeFileSync(

benchmark/napi/function_args/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ let napi;
1111

1212
try {
1313
v8 = require('./build/Release/binding');
14-
} catch (err) {
14+
} catch {
1515
console.error(`${__filename}: V8 Binding failed to load`);
1616
process.exit(0);
1717
}
1818

1919
try {
2020
napi = require('./build/Release/napi_binding');
21-
} catch (err) {
21+
} catch {
2222
console.error(`${__filename}: NAPI-Binding failed to load`);
2323
process.exit(0);
2424
}

benchmark/napi/function_call/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const common = require('../../common.js');
1313

1414
try {
1515
var binding = require('./build/Release/binding');
16-
} catch (er) {
16+
} catch {
1717
console.error('misc/function_call.js Binding failed to load');
1818
process.exit(0);
1919
}
@@ -22,7 +22,7 @@ const cxx = binding.hello;
2222
let napi_binding;
2323
try {
2424
napi_binding = require('./build/Release/napi_binding');
25-
} catch (er) {
25+
} catch {
2626
console.error('misc/function_call/index.js NAPI-Binding failed to load');
2727
process.exit(0);
2828
}

0 commit comments

Comments
 (0)