From 40b3ad3eb8b5ba9e57d534285362f3c07532eebc Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sun, 4 Nov 2018 12:38:54 -0500 Subject: [PATCH] benchmark: remove unused catch bindings PR-URL: https://github.com/nodejs/node/pull/24079 Reviewed-By: Sam Roberts Reviewed-By: Wyatt Preul --- benchmark/_http-benchmarkers.js | 4 ++-- benchmark/child_process/child-process-exec-stdout.js | 2 +- benchmark/fs/read-stream-throughput.js | 4 ++-- benchmark/fs/readfile-partitioned.js | 4 ++-- benchmark/fs/readfile.js | 4 ++-- benchmark/fs/write-stream-throughput.js | 4 ++-- benchmark/misc/punycode.js | 2 +- benchmark/module/module-loader.js | 2 +- benchmark/napi/function_args/index.js | 4 ++-- benchmark/napi/function_call/index.js | 4 ++-- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/benchmark/_http-benchmarkers.js b/benchmark/_http-benchmarkers.js index baa50f72cde906..f66c36ab1d3d19 100644 --- a/benchmark/_http-benchmarkers.js +++ b/benchmark/_http-benchmarkers.js @@ -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) { @@ -106,7 +106,7 @@ class TestDoubleBenchmarker { let result; try { result = JSON.parse(output); - } catch (err) { + } catch { return undefined; } return result.throughput; diff --git a/benchmark/child_process/child-process-exec-stdout.js b/benchmark/child_process/child-process-exec-stdout.js index a891026b86971f..88c02533f605c2 100644 --- a/benchmark/child_process/child-process-exec-stdout.js +++ b/benchmark/child_process/child-process-exec-stdout.js @@ -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 { diff --git a/benchmark/fs/read-stream-throughput.js b/benchmark/fs/read-stream-throughput.js index 3af80132725ec0..7f290a310b592c 100644 --- a/benchmark/fs/read-stream-throughput.js +++ b/benchmark/fs/read-stream-throughput.js @@ -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)); }); @@ -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); diff --git a/benchmark/fs/readfile-partitioned.js b/benchmark/fs/readfile-partitioned.js index be3b7fd057bbe0..6e355c158da850 100644 --- a/benchmark/fs/readfile-partitioned.js +++ b/benchmark/fs/readfile-partitioned.js @@ -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; @@ -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() { diff --git a/benchmark/fs/readfile.js b/benchmark/fs/readfile.js index 282b4ac7621340..36439bdf909f1d 100644 --- a/benchmark/fs/readfile.js +++ b/benchmark/fs/readfile.js @@ -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; @@ -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); diff --git a/benchmark/fs/write-stream-throughput.js b/benchmark/fs/write-stream-throughput.js index 60ad47bc4eabe1..baf98f849fed07 100644 --- a/benchmark/fs/write-stream-throughput.js +++ b/benchmark/fs/write-stream-throughput.js @@ -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; @@ -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); }); diff --git a/benchmark/misc/punycode.js b/benchmark/misc/punycode.js index a55660fbc07247..c9eef1f7096fac 100644 --- a/benchmark/misc/punycode.js +++ b/benchmark/misc/punycode.js @@ -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, { diff --git a/benchmark/module/module-loader.js b/benchmark/module/module-loader.js index c79e1a73d4f21a..e780d6376b5e8d 100644 --- a/benchmark/module/module-loader.js +++ b/benchmark/module/module-loader.js @@ -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( diff --git a/benchmark/napi/function_args/index.js b/benchmark/napi/function_args/index.js index 4beab531c17301..c41b5d78abadd9 100644 --- a/benchmark/napi/function_args/index.js +++ b/benchmark/napi/function_args/index.js @@ -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); } diff --git a/benchmark/napi/function_call/index.js b/benchmark/napi/function_call/index.js index cbc512c9729137..272c41662d2830 100644 --- a/benchmark/napi/function_call/index.js +++ b/benchmark/napi/function_call/index.js @@ -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); } @@ -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); }